Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Alfredo Mazzinghi
llvm-project
Commits
94786cb8
Commit
94786cb8
authored
Apr 08, 2021
by
Diana Picus
Browse files
[Morello][lldb] Add more end-to-end tests
Test the disassembly command, as well as memory and register reads.
parent
792db891
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
145 additions
and
0 deletions
+145
-0
lldb/morello-android-tests/disassembly/Android.bp
lldb/morello-android-tests/disassembly/Android.bp
+11
-0
lldb/morello-android-tests/disassembly/disassembly.test
lldb/morello-android-tests/disassembly/disassembly.test
+14
-0
lldb/morello-android-tests/disassembly/main.c
lldb/morello-android-tests/disassembly/main.c
+16
-0
lldb/morello-android-tests/memory/Android.bp
lldb/morello-android-tests/memory/Android.bp
+11
-0
lldb/morello-android-tests/memory/main.c
lldb/morello-android-tests/memory/main.c
+10
-0
lldb/morello-android-tests/memory/memory.test
lldb/morello-android-tests/memory/memory.test
+11
-0
lldb/morello-android-tests/register/Android.bp
lldb/morello-android-tests/register/Android.bp
+11
-0
lldb/morello-android-tests/register/main.c
lldb/morello-android-tests/register/main.c
+13
-0
lldb/morello-android-tests/register/register.test
lldb/morello-android-tests/register/register.test
+48
-0
No files found.
lldb/morello-android-tests/disassembly/Android.bp
0 → 100755
View file @
94786cb8
cc_test {
name: "disassembly",
srcs: [
"main.c"
],
cflags: [
"-g", "-O0"
],
compile_multilib: "c64",
gtest: false,
}
lldb/morello-android-tests/disassembly/disassembly.test
0 → 100644
View file @
94786cb8
breakpoint
set
-
p
"Break here"
process
launch
--
disassemble
-
n
func_in_same_exec
# CHECK-LABEL: (lldb) disassemble -n func_in_same_exec
# CHECK: sub csp, csp, #0x10
# CHECK-NEXT: add c1, csp, #0xc
# CHECK-NEXT: scbnds c1, c1, #0x4
# CHECK-NEXT: add csp, csp, #0x10
# CHECK-NEXT: ret c30
# TODO: Check that we can disassemble a function from a .so
process
kill
lldb/morello-android-tests/disassembly/main.c
0 → 100755
View file @
94786cb8
__attribute__
((
naked
))
void
func_in_same_exec
()
{
// This doesn't need to make sense or do anything useful, anything goes as
// long as it contains some capabilities and doesn't trigger any faults.
asm
volatile
(
"
\t
sub csp, csp, #0x10
\n
"
"
\t
add c1, csp, #0xc
\n
"
"
\t
scbnds c1, c1, #0x4
\n
"
"
\t
add csp, csp, #0x10
\n
"
"
\t
ret c30
\n
"
);
}
int
main
()
{
func_in_same_exec
();
// Break here
return
0
;
}
lldb/morello-android-tests/memory/Android.bp
0 → 100755
View file @
94786cb8
cc_test {
name: "memory",
srcs: [
"main.c"
],
cflags: [
"-g", "-O0"
],
compile_multilib: "c64",
gtest: false,
}
lldb/morello-android-tests/memory/main.c
0 → 100755
View file @
94786cb8
int
function_using_address
()
{
int
data
=
133
;
int
*
an_address
=
&
data
;
return
*
an_address
;
// Break here
}
int
main
()
{
function_using_address
();
return
0
;
}
lldb/morello-android-tests/memory/memory.test
0 → 100644
View file @
94786cb8
breakpoint
set
-
p
"Break here"
process
launch
--
frame
variable
an_address
memory
read
-
C
-
c
1
-
f
capability
&
an_address
# CHECK-LABEL: (lldb) frame variable an_address
# CHECK: {[[ADDRESS:.*]]}
# CHECK: (lldb) memory read -C -c 1 -f capability &an_address
# CHECK: 0x{{[0-9a-fA-F]*}}: {[[ADDRESS]]}
process
kill
lldb/morello-android-tests/register/Android.bp
0 → 100755
View file @
94786cb8
cc_test {
name: "register",
srcs: [
"main.c"
],
cflags: [
"-g", "-O0"
],
compile_multilib: "c64",
gtest: false,
}
lldb/morello-android-tests/register/main.c
0 → 100755
View file @
94786cb8
#include <stdint.h>
int
main
()
{
uint64_t
value
=
0xdeaddeaddeadbeef
;
asm
volatile
(
"
\t
scvalue c11, c11, %[VALUE]
\n
"
"
\t
scbnds c11, c11, #4
\n
"
:
:
[
VALUE
]
"r"
(
value
)
:
"c11"
);
return
0
;
// Break here
}
lldb/morello-android-tests/register/register.test
0 → 100644
View file @
94786cb8
breakpoint
set
-
p
"Break here"
process
launch
--
register
read
c11
# CHECK-LABEL: (lldb) register read c11
# CHECK: c11 = 0x{{[0-9a-fA-F]+}}7ef3beefdeaddeaddeadbeef
register
read
-
f
capability
c11
# CHECK-LABEL: (lldb) register read -f capability c11
# CHECK: c11 = {tag = {{.*}}, address = 0xdeaddeaddeadbeef, {{.*}}range = [0xdeaddeaddeadbeef-0xdeaddeaddeadbef3)
register
read
x11
# CHECK-LABEL: (lldb) register read x11
# CHECK: x11 = 0xdeaddeaddeadbeef
register
read
c29
# CHECK-LABEL: (lldb) register read c29
# CHECK: cfp = [[C29:.*]]
register
read
cfp
# CHECK-LABEL: (lldb) register read cfp
# CHECK: cfp = [[C29]]
register
read
x29
# CHECK-LABEL: (lldb) register read x29
# CHECK: fp = [[X29:.*]]
register
read
fp
# CHECK-LABEL: (lldb) register read fp
# CHECK: fp = [[X29]]
register
read
clr
# CHECK-LABEL: (lldb) register read clr
# CHECK: clr = 0x{{[0-9a-fA-F]+}}
register
read
csp
# CHECK-LABEL: (lldb) register read csp
# CHECK: csp = 0x{{[0-9a-fA-F]+}}
register
read
pcc
# CHECK-LABEL: (lldb) register read pcc
# CHECK: pcc = 0x{{[0-9a-fA-F]+}}
register
read
ddc
# CHECK-LABEL: (lldb) register read ddc
# CHECK: ddc = 0x{{[0-9a-fA-F]+}}
process
kill
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment