bsdjhb / gdb Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
README for GNU development tools This directory contains various GNU compilers, assemblers, linkers, debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. If with a binutils release, see binutils/README; if with a libg++ release, see libg++/README, etc. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. It is now possible to automatically configure and build a variety of tools with one command. To build all of the tools contained herein, run the ``configure'' script here, e.g.: ./configure make To install them (by default in /usr/local/bin, /usr/local/lib, etc), then do: make install (If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, and OS.) If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. For example (assuming sh/bash/ksh): CC=gcc ./configure make A similar example using csh: setenv CC gcc ./configure make Much of the code and documentation enclosed is copyright by the Free Software Foundation, Inc. See the file COPYING or COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info on where and how to report problems.
I tried adding the clcbi to the disassembler table but for some reason gdb still decodes them as jalx.
If I try to step over them gdb attempts to break at the nonsense address that the jalx would decode to:
0x1200b00f0 <__start+72> jalx 0x121540000 โ
0x1200b00f4 <__start+76> jalx 0x122d4000
This is actually the following:
1200b00ec: 4a 81 0b 80 csetbounds $c1, $c1, 896
; for (struct capreloc *reloc = &__start___cap_relocs ;
1200b00f0: 74 55 00 00 clcbi $c2, 0($c21)
1200b00f4: 74 b5 00 02 clcbi $c5, 32($c21)
In case it is helpful here are the bits used by the LLVM tablegen definition of the instruction:
let Opcode = op; // (op = 0x1d)
let Inst{25-21} = cs;
let Inst{20-16} = cb;
let Inst{15-0} = offset; // scaled by 4 bits like clc
This doesn't work if $pcc.base is non-zero:
Program received signal SIGPROT, CHERI protection violation.
Jan 2 02:04:17 qemu-cheri256-alr48 kernel: USER_CHERI_EXCEPTION: pid 987 tid 100057 (cheri_helloworld), uid 0: CP2 fault (type 0x32)
0x00000000000089e0 in ?? ()
(gdb) p $pcc
$1 = {attr = [ G X R uP=7 type=0 ], cursor = 1083742688, base = 1083707392,
length = 18446744073709494271}
(gdb) p/x $pcc
$2 = {attr = 0xe, cursor = 0x409899e0, base = 0x40981000, length = 0xffffffffffff1fff}
reproducer files in zeno:~alr48/gdb-test/cheri_helloworld
(binary, sandbox.co, qemu trace and core file)
Would it be possible to implement the equivalent of qtrace exec
with the qtrace
command?
Or even better add the user-only tracing nop?
This would require gdb to set the MDTD_QTRACE
trace on the currently debugged process.
gdb crashes on 128 like this:
root@qemu-cheri128-en322:~ # /gdb
/usr/local/jenki$c00: v:1 s:0 p:0007807d b:0000000000000000 l:0000010000000000 o:0 t:0
$c01: v:1 s:0 p:0007807d b:0000000000000000 l:0000010000000000 o:40c12300 t:0
$c02: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c03: v:1 s:0 p:0007807d b:0000000040c58000 l:0000000000000010 o:0 t:0
$c04: v:1 s:0 p:0007807d b:0000000040c12300 l:0000000000000010 o:0 t:0
$c05: v:0 s:1 p:00017fba b:e400000000000000 l:1bffffffffffffff o:7d6c2f6a656e6b69 t:2f6f63
$c06: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c07: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c08: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c09: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c10: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c11: v:1 s:0 p:0007807d b:0000000000000000 l:0000010000000000 o:0 t:0
$c12: v:1 s:0 p:00068017 b:0000000000000000 l:0000010000000000 o:1c0000 t:0
$c13: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c14: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c15: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c16: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c17: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c18: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c19: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c20: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c21: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c22: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c23: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c24: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0
$c26: v:1 s:0 p:0007807d b:0000000000000000 l:0000010000000000 o:0 t:0
$c31: v:1 s:0 p:00068017 b:0000000000000000 l:0000010000000000 o:53ac78 t:0
Jul 12 14:49:45 qemu-cheri128-en322 kernel: BAD_PAGE_FAULT: pid 588 tid 100055 (gdb), uid 0: pc 0x53ac78 got a read fault (type 0x2) at 0x4
Jul 12 14:49:45 qemu-cheri128-en322 kernel: Trapframe Register Dump:
Jul 12 14:49:45 qemu-cheri128-en322 kernel: $0: 0 at: 0 v0: 0x50 v1: 0x40c15018
Jul 12 14:49:45 qemu-cheri128-en322 kernel: a0: 0 a1: 0x40c262e0 a2: 0x40c00000 a3: 0x3
Jul 12 14:49:45 qemu-cheri128-en322 kernel: a4: 0x26 a5: 0x30 a6: 0x30 a7: 0x40c15000
Jul 12 14:49:45 qemu-cheri128-en322 kernel: t0: 0 t1: 0 t2: 0x2188a0 t3: 0x8edf08
Jul 12 14:49:45 qemu-cheri128-en322 kernel: s0: 0 s1: 0x7fffffe49c s2: 0x8ddf90 s3: 0x8ddf90
Jul 12 14:49:45 qemu-cheri128-en322 kernel: s4: 0x4 s5: 0x40c2d800 s6: 0x4e s7: 0x59
Jul 12 14:49:45 qemu-cheri128-en322 kernel: t8: 0x10 t9: 0x53ac28 k0: 0 k1: 0
Jul 12 14:49:45 qemu-cheri128-en322 kernel: gp: 0x8ddf90 sp: 0x7fffffe490 s8: 0x7fffffe490 ra: 0x3dc68c
Jul 12 14:49:45 qemu-cheri128-en322 kernel: status: 0x408084b3 mullo: 0x3333333333333335; mulhi: 0x1; badvaddr: 0x4
Jul 12 14:49:45 qemu-cheri128-en322 kernel: cause: 0x8; pc: 0x53ac78
Jul 12 14:49:45 qemu-cheri128-en322 kernel: Page table info for bad address 0x4: pde = 0x9800000003e63000, pte = 0
Segmentation fault (core dumped)
root@qemu-cheri128-en322:~ # addr2line -e /gdb 0x53ac78
??:0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.