From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20450 invoked from network); 24 Jun 2020 23:37:57 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 24 Jun 2020 23:37:57 -0000 Received: (qmail 27841 invoked by uid 550); 24 Jun 2020 23:37:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 27713 invoked from network); 24 Jun 2020 23:37:49 -0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=NOXSFv51R/5fNwj/4eyNTtqOP BI=; b=rCISKX4vlVNT0VrpnLScBtqNAy74gaBD5wyTe1woNNtIJE7k/8azDp4Lr tC0m0XhONUXCi6wFEKzSVOOV8N2F8W6NcUB74sIPTMShOaLiaMa8b1qXsANG+5pg eLXz/97WAmTckKWjlbcfSnTZrgDQwplsBqnU2Gor1qpygTCacw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; q=dns; s=sasl; b=hXMqN0QHyyOWgOc9IF3 YRgolyFSYiBkQEVlJhRDhzSPk58MKwNKRvD7+bUTSOTpX4F4VaR0VA10yAcsFvG/ LhnjaNUUzh/Xe8hu5AFDEzAlCbLT2W9hfTR1VjNuj6ck3pJVycSqARm3zM9sXJrv nXpwxsLKJSwRNxoSwlmJgTh4= From: Daniel Santos To: musl@lists.openwall.com Cc: daniel@gsat.us, Daniele Tamino , Daniel Santos Date: Wed, 24 Jun 2020 18:35:16 -0500 Message-Id: <20200624233517.4909-2-daniel.santos@pobox.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200624233517.4909-1-daniel.santos@pobox.com> References: <20200624233517.4909-1-daniel.santos@pobox.com> MIME-Version: 1.0 X-Pobox-Relay-ID: AE315BE0-B673-11EA-B514-B0405B776F7B-06139138!pb-smtp20.pobox.com Content-Transfer-Encoding: quoted-printable Subject: [musl] [PATCH 1/2] mipsel: Add debug information to __syscall_cp_asm This is the function called for interruptable / repeatable syscalls like nanosleep. Without this patch, attaching a debugger to a program making such a syscall results in the debugger being completely unable to perform a backtrace. Co-Authored-By: Daniele Tamino Signed-off-by: Daniel Santos --- src/thread/mips/syscall_cp.s | 41 +++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/thread/mips/syscall_cp.s b/src/thread/mips/syscall_cp.s index d2846264..d39bff59 100644 --- a/src/thread/mips/syscall_cp.s +++ b/src/thread/mips/syscall_cp.s @@ -1,4 +1,14 @@ +.section .mdebug.abi32 +.previous .set noreorder +.cfi_sections .debug_frame +.abicalls +#ifdef __PIC__ + .option pic2 +#else + .option pic0 +#endif +.text =20 .global __cp_begin .hidden __cp_begin @@ -9,12 +19,32 @@ .global __cp_cancel .hidden __cp_cancel .type __cp_cancel,@function -.hidden __cancel +.hidden __cancel /* long __cancel() in src/thread/pthread_cancel.c */ .global __syscall_cp_asm .hidden __syscall_cp_asm .type __syscall_cp_asm,@function + +/* +long __syscall_cp_asm( + volatile int *cancel, + syscall_arg_t nr, + syscall_arg_t u, + syscall_arg_t v, + syscall_arg_t w, + syscall_arg_t x, + syscall_arg_t y, + syscall_arg_t z) +*/ + + .ent __syscall_cp_asm + .frame $sp, 32, $ra + .mask 0x00000000, 0 + .fmask 0x00000000, 0 + .cfi_startproc + .cfi_return_column $ra __syscall_cp_asm: subu $sp, $sp, 32 + .cfi_adjust_cfa_offset 32 __cp_begin: lw $4, 0($4) bne $4, $0, __cp_cancel @@ -35,14 +65,17 @@ __cp_begin: __cp_end: beq $7, $0, 1f addu $sp, $sp, 32 + .cfi_adjust_cfa_offset -32 subu $2, $0, $2 1: jr $ra nop =20 __cp_cancel: move $2, $ra + .cfi_register $ra, $2 bal 1f addu $sp, $sp, 32 + .cfi_adjust_cfa_offset -32 .gpword . .gpword __cancel 1: lw $3, ($ra) @@ -51,3 +84,9 @@ __cp_cancel: addu $25, $25, $3 jr $25 move $ra, $2 + .cfi_restore $ra +#ifdef __ELF__ + .size __syscall_cp_asm,.-__syscall_cp_asm +#endif + .end __syscall_cp_asm + .cfi_endproc --=20 2.24.1