From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 48FE838618C6 for ; Fri, 3 Jul 2020 09:50:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48FE838618C6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=scylladb.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bdenes@scylladb.com Received: by mail-ej1-x634.google.com with SMTP id w16so33557575ejj.5 for ; Fri, 03 Jul 2020 02:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scylladb-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:user-agent:mime-version :content-transfer-encoding; bh=lNFK89edxYPK9XiVJtr4+yh9/I7N+d41p9sdOsVDi30=; b=WaSQV3qCXEA/NFNUAiwCgdHWuV5otD3fJMSDcRi1QtbkzSTcclqvY1PNDrkvlCSJ87 czKaG17SvzwpvmtgtkwYmtzzvRzgOqRju+8MTH7vDRGeSs9OHEQpCnWgkV0OQkD79LXa WwPUEV9DqB1C5FY+NM8ROLtBDbNU8nTvO9pDuoSEvZPxMA0NR0NRRNllrVjnonQRC3zR cnZM20Rre+XWdQ7zEcnJZ/zh1zkv1GKtdviIrNAUFbbKYxWC5k8aZy3adCUA/q76TJ95 r+WdF+Eh+uo0R94wZP3vyVtkmHt7tEnXMS/REprPZh3QAqzD9iR4Hme/W8Cadhc4u1bk cNTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:user-agent :mime-version:content-transfer-encoding; bh=lNFK89edxYPK9XiVJtr4+yh9/I7N+d41p9sdOsVDi30=; b=ucExKdHdorLE+9DEd3dZOFOMuZ0BFHHpVy3wI0gpuUzYIBRR5cRwZeSRvbcsGUsH26 86ga9lL5iZqChXsQsMkMiXKH2hK6S0Vo/LPV+b2gpj58qYdfSxtors2O46Nf4COZo0WO ojukrU5hbm1IZzhoIPc1sqRv0K0AB2eHg39NMSZv9WKO156tFdtdOgSr/K24HWCCOyOK Xem1Ay3wHkcrLGc7jFCOj9XOKr9vI4/UEcHWoFfAk1H46I1w9X4t1DfIGis+lSXajVE3 fPYbQIY7E84jrM9JFG07G4JAYB27J4Pxr4tBAP+MDa6N7iD9UBRqza8GRboVuqL2ZNOp DZvw== X-Gm-Message-State: AOAM5331lvb4JxHNvJD2BQqxWjZdJmgtOlmJnC3nSwLaZOEcenkG9Ji3 dwVxV3kogps+xLnHfFNzxyvBPyN9m7A= X-Google-Smtp-Source: ABdhPJw250qZh4zJ3heJINKBN9+aJg+aU6p0F7oLSqkuEMJJHZMGa88zgJWWZQpMhXPX5ToWa6UB7w== X-Received: by 2002:a17:907:1059:: with SMTP id oy25mr33634922ejb.90.1593769857169; Fri, 03 Jul 2020 02:50:57 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f01:8315:eb00:1d10:a7c5:63e1:277a]) by smtp.gmail.com with ESMTPSA id m6sm8824844ejq.85.2020.07.03.02.50.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 02:50:56 -0700 (PDT) Message-ID: Subject: Stack unwinding for green threads From: Botond =?ISO-8859-1?Q?D=E9nes?= To: gdb@sourceware.org Date: Fri, 03 Jul 2020 12:50:54 +0300 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 (3.36.3-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2020 09:50:59 -0000 Hi, I'm working on Scylla [1], an application which is built using the seastar framework [2]. This framework provides green threads [3] that have their own stacks. These threads are created with `setcontext()` and later we switch in/out using `setjmp()`/`longjmp()`. We have a collection of python scripts [4] to help debug Scylla, among these we have a utility command which allows switching in/out of these green threads in gdb. This command basically (tries) to emulate `setjmp()`/`longjmp()` in python, saving and restoring registers. There are several problems with this method. For starters it crashes gdb for some time now, and also it doesn't work in coredumps, where gdb refuses to write to registers (even after `set write on`). So for these reasons I started to look for alternative ways to unwind the stacks of our green threads. However after going through the gdb documentation [5], reading all I could find about threads, stacks, frames and the Python API I haven't found an entry point to call which would unwind a stack located at a custom address (not the current $rsp). Is there such an API that I haven't found? Is there another way to achive what I want? Alternatively, how hard would it be to implement such an API? Thanks, Botond [1] https://github.com/scylladb/scylla [2] https://github.com/scylladb/seastar [3] http://docs.seastar.io/master/group__thread-module.html [4] https://github.com/scylladb/scylla/blob/master/scylla-gdb.py [5] https://sourceware.org/gdb/onlinedocs/gdb/index.html