mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
test-gdb: can now run in either userland or baremetal modes
Selection with --mode userland (default because has x86_64) or --mode baremetal. This is the first userland tool where this choice is done on the command line, which led to a refactor of supported_archs and is_baremetal and is_userland into a single self.env['mode'].
This commit is contained in:
1
userland/arch/aarch64/gdb_tests/build
Symbolic link
1
userland/arch/aarch64/gdb_tests/build
Symbolic link
@@ -0,0 +1 @@
|
||||
../build
|
||||
1
userland/arch/aarch64/gdb_tests/test
Symbolic link
1
userland/arch/aarch64/gdb_tests/test
Symbolic link
@@ -0,0 +1 @@
|
||||
../test
|
||||
1
userland/arch/arm/gdb_tests/build
Symbolic link
1
userland/arch/arm/gdb_tests/build
Symbolic link
@@ -0,0 +1 @@
|
||||
../build
|
||||
1
userland/arch/arm/gdb_tests/test
Symbolic link
1
userland/arch/arm/gdb_tests/test
Symbolic link
@@ -0,0 +1 @@
|
||||
../test
|
||||
1
userland/arch/x86_64/gdb_tests/README.adoc
Normal file
1
userland/arch/x86_64/gdb_tests/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
https://github.com/cirosantilli/linux-kernel-module-cheat#gdb-tests
|
||||
1
userland/arch/x86_64/gdb_tests/build
Symbolic link
1
userland/arch/x86_64/gdb_tests/build
Symbolic link
@@ -0,0 +1 @@
|
||||
../build
|
||||
11
userland/arch/x86_64/gdb_tests/integer_registers.S
Normal file
11
userland/arch/x86_64/gdb_tests/integer_registers.S
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
/* 1 + 2 == 3 */
|
||||
mov $1, %rax
|
||||
/* test-gdb-op1 */
|
||||
mov $2, %rbx
|
||||
add %rax, %rbx
|
||||
/* test-gdb-result */
|
||||
LKMC_ASSERT_EQ(%rbx, $3)
|
||||
LKMC_EPILOGUE
|
||||
7
userland/arch/x86_64/gdb_tests/integer_registers.py
Normal file
7
userland/arch/x86_64/gdb_tests/integer_registers.py
Normal file
@@ -0,0 +1,7 @@
|
||||
def test(self):
|
||||
self.sendline('tbreak main')
|
||||
self.sendline('continue')
|
||||
self.continue_to('op1')
|
||||
assert self.get_int('$rax') == 1
|
||||
self.continue_to('result')
|
||||
assert self.get_int('$rbx') == 3
|
||||
10
userland/arch/x86_64/gdb_tests/set_registers.S
Normal file
10
userland/arch/x86_64/gdb_tests/set_registers.S
Normal file
@@ -0,0 +1,10 @@
|
||||
/* Test that we can set registers from GDB. */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
mov $1, %rax
|
||||
/* test-gdb-rax */
|
||||
mov $2, %rbx
|
||||
/* test-gdb-rbx */
|
||||
LKMC_EPILOGUE
|
||||
9
userland/arch/x86_64/gdb_tests/set_registers.py
Normal file
9
userland/arch/x86_64/gdb_tests/set_registers.py
Normal file
@@ -0,0 +1,9 @@
|
||||
def test(self):
|
||||
self.sendline('tbreak main')
|
||||
self.sendline('continue')
|
||||
|
||||
self.continue_to('rax')
|
||||
self.sendline('set $rax = 3')
|
||||
self.continue_to('rbx')
|
||||
assert self.get_int('$rax') == 3
|
||||
assert self.get_int('$rbx') == 2
|
||||
1
userland/arch/x86_64/gdb_tests/test
Symbolic link
1
userland/arch/x86_64/gdb_tests/test
Symbolic link
@@ -0,0 +1 @@
|
||||
../test
|
||||
Reference in New Issue
Block a user