Get GDB working
Some checks failed
build / matrix_on_mode () (push) Has been cancelled
build / matrix_on_mode (optlinux) (push) Has been cancelled
build / matrix_on_mode (rel) (push) Has been cancelled
build / matrix_on_mode (tiny) (push) Has been cancelled
build / matrix_on_mode (tinylinux) (push) Has been cancelled

You can now say `gdb hello.com.dbg` and it'll work perfectly.
This commit is contained in:
Justine Tunney 2025-03-30 15:25:20 -07:00
parent afc986f741
commit fbc4fcbb71
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
18 changed files with 230 additions and 67 deletions

View file

@ -21,16 +21,15 @@
.privileged
cosmo_futex_thunk:
beg
pro
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
mov %rcx,%r10
mov __NR_futex,%eax
clc
syscall
jnc 1f
neg %eax
1: pop %rbp
#elif defined(__aarch64__)
ldr x7,=__hostos
ldr w7,[x7]
@ -46,5 +45,7 @@ cosmo_futex_thunk:
#else
#error "unsupported architecture"
#endif /* __x86_64__ */
1: ret
1: epi
ret
end
.endfn cosmo_futex_thunk,globl,hidden

View file

@ -26,7 +26,9 @@
// @see setcontext()
.ftrace1
getcontext:
beg
.ftrace2
#include "libc/intrin/getcontext.inc"
jmp __getcontextsig
end
.endfn getcontext,globl

View file

@ -31,17 +31,17 @@
// @returnstwice
.ftrace1
swapcontext:
beg
.ftrace2
#include "libc/intrin/getcontext.inc"
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
push %rsi
push %rsi
pro
cpush %rsi
cpush %rsi
call __swapcontextsig
pop %rdi
pop %rdi
pop %rbp
cpop %rdi
cpop %rdi
epi
test %eax,%eax
jnz 1f
#elif defined(__aarch64__)
@ -56,4 +56,5 @@ swapcontext:
#endif
jmp __tailcontext
1: ret
end
.endfn swapcontext,globl

View file

@ -24,9 +24,9 @@
//
// @return 0 on success, or -1 w/ errno
sys_sched_yield:
beg
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
pro
xor %eax,%eax
mov __hostos(%rip),%dl
@ -84,13 +84,16 @@ sys_sched_yield:
// fails a positive or negative errno might get returned.
#endif
9: leave
9: epi
ret
#elif defined(__aarch64__)
stp x29,x30,[sp,-32]!
mov x29,sp
.cfi_adjust_cfa_offset 32
.cfi_rel_offset x29,16
.cfi_rel_offset x30,24
mov x3,0
mov x2,0
add x4,sp,16
@ -101,10 +104,14 @@ sys_sched_yield:
mov x16,#0x5d // select(0,0,0,0,&blah) for xnu
svc 0
ldp x29,x30,[sp],32
.cfi_adjust_cfa_offset -32
.cfi_restore x30
.cfi_restore x29
ret
#else
#error "arch unsupported"
#endif
end
.endfn sys_sched_yield,globl
.previous