History

riscv64: Work around qemu bug

old qemu (before april 2020) have a bug in the layout of struct ucontext, so we get invalid values under qemu-userspace emulation when inspecting the signal context. Try to recognize this and graciously error out instead of segfaulting in the backtracer routines.

Michael Matz committed 6 years ago

Commit 9b2329f1 parent 2e798521 file · +3 −1Browse files

Unified · Split

tccrun.c+3−1
@@ -843,8 +843,10 @@ static int rt_get_caller_pc(addr_t *paddr, rt_context *rc, int level) · 842 unmodified lines
843 *paddr = rc->ip;843 *paddr = rc->ip;
844 } else {844 } else {
845 addr_t *fp = (addr_t*)rc->fp;845 addr_t *fp = (addr_t*)rc->fp;
846 while (--level)846 while (--level && fp >= (addr_t*)0x1000)
847 fp = (addr_t *)fp[-2];847 fp = (addr_t *)fp[-2];
848 if (fp < (addr_t*)0x1000)
849 return -1;
848 *paddr = fp[-1];850 *paddr = fp[-1];
849 }851 }
850 return 0;852 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t