Essential C++
- 前言
- 7.1 抛出异常
- 7.2 捕获异常
- 7.3 提炼异常
- 7.4 局部资源管理
- 7.5 标准异常
前言
通过Essential C++
笔记的形式对C++相关重点知识
进行汇总,读者通读此系列文章就可以轻松的把该语言基础捡起来。
7.1 抛出异常
7.2 捕获异常
7.3 提炼异常
7.4 局部资源管理
7.5 标准异常
<缺页异常后输出的宕机日志信息>
benshushu:test_syscall_issue# insmod testsyscall_issue.ko
[ 99.777689] Found the sys_call_table at ffff000011771970.
[ 99.979256] replace system call …
[ 99.980261] walk_pagetable get pte=0x7BFFC003
[ 99.981665] mkwrite pte=0x800007BFFC403
[ 99.983618] got sys_call_table[220] at 0.
//第1部分:判断错误类型
[ 99.986748] Unable to handle kernel write to read-only memory at virtual address
ffff000011772050
//第2部分:输出与ESR相关的信息
[ 99.987979] Mem abort info:
[ 99.988338] ESR = 0x9600004f
[ 99.990267] Exception class = DABT (current EL), IL = 32 bits
[ 99.991557] SET = 0, FnV = 0
[ 99.991766] EA = 0, S1PTW = 0
[ 99.991975] Data abort info:
[ 99.992123] ISV = 0, ISS = 0x0000004f
[ 99.992290] CM = 0, WnR = 1
//第3部分:遍历页表并输出页表项信息
[ 99.996224] swapper pgtable: 4k pages, 48-bit VAs, pgdp = (ptrval)
[ 99.998666] [ffff000011772050] pgd=000000007bfff003, pud=000000007bffe003,
pmd=000800007bffc403, pte=00e0000041772793
//第4部分:输出寄存器信息和内核调用路径
[ 100.009747] Internal error: Oops: 9600004f [#1] SMP
[ 100.013393] Modules linked in: testsyscall_issue(OE+)
[ 100.017969] CPU: 1 PID: 586 Comm: insmod Tainted: G OE 5.0.0+ #2
[ 100.018714] Hardware name: linux,dummy-virt (DT)
[ 100.019481] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 100.021494] pc : hack_syscall_init+0x4bc/0x1000 [testsyscall_issue]
[ 100.022313] lr : hack_syscall_init+0x458/0x1000 [testsyscall_issue]
[ 100.024056] sp : ffff800034f1f620
[ 100.035893] x29: ffff800034f1f620 x28: ffff8000364caa00
[ 100.039600] x27: 0000000000000000 x26: 0000000000000000
[ 100.041063] x25: 0000000056000000 x24: 0000000000000015
[ 100.044269] x23: 0000000040001000 x22: 0000ffff92289f34
[ 100.047647] x21: 00000000ffffffff x20: 000080002a14d000
[ 100.050859] x19: 0000000000000000 x18: 0000000000000000
[ 100.057400] x17: 0000000000000000 x16: 0000000000000000
[ 100.062117] x15: ffffffffffffffff x14: 4d554e5145530065
[ 100.072102] x13: 6c75646f6d3d4d45 x12: 5453595342555300
[ 100.081611] x11: 0000000000000038 x10: 0101010101010101
[ 100.087294] x9 : 0000000000000006 x8 : 2020202020207461
[ 100.101715] x7 : 205d3032325b656c x6 : ffff00001203a48b
[ 100.109034] x5 : ffff000010186a4c x4 : ffff80003bd9ff88
[ 100.109726] x3 : ffff80003bd9ff88 x2 : 73be555acfb8c200
[ 100.110927] x1 : ffff000009770000 x0 : ffff000011772050
[ 100.111739] Process insmod (pid: 586, stack limit = 0x(ptrval))
[ 100.149687] Call trace:
[ 100.155731] hack_syscall_init+0x4bc/0x1000 [testsyscall_issue]
[ 100.167878] do_one_initcall+0x430/0x9f0
[ 100.169306] do_init_module+0xb8/0x2f8
[ 100.170888] load_module+0x8e0/0xbc0
[ 100.189921] __se_sys_finit_module+0x14c/0x180
[ 100.190620] __arm64_sys_finit_module+0x44/0x4c
[ 100.191320] __invoke_syscall+0x28/0x30
[ 100.191741] invoke_syscall+0xa8/0xdc
[ 100.192513] el0_svc_common+0xf8/0x1d4
[ 100.193192] el0_svc_handler+0x3bc/0x3e8
[ 100.193698] el0_svc+0x8/0xc
[ 100.195419] Code: d37df000 8b000020 f0ffffc1 91000021 (f9000001)
[ 100.208174] —[ end trace f615fe47ebd49ea7 ]—
Segmentation fault