From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id CCFEE3858D35 for ; Wed, 15 Feb 2023 13:22:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCFEE3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-x229.google.com with SMTP id bg11so1028994oib.9 for ; Wed, 15 Feb 2023 05:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:sender:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=aSrkxpA7geaX2vRJhurqbTURZUDXkhhsF1w6Cfguz9w=; b=Tmq/aLECJ4ktTKwe6m4mqASlPJL+bR+TglRgVO59nPo/cp+iU1Ou7A+yMxjt5DqSav Ezav7wy+gi5ZuYvJxh10a7NfAI7X3/mTft9HIZ1bSdLJWz9UptmiIIApSGJSTyBCxA2L eKnR1hj4+6wK7eteT9R6vI4DqM3Feu3TREEyaS0/jdomc2au828UF+t5UtNhHuiQcTf2 LHUtc5loW26rdqKWaFFJRUTj217T1oPPbXrUu7gMxeIDILVIRmk23pszTtdlt63RZeBe AFJRsP8T5RkDrqsxpDtOQcGH19mf1VwmIoABtCgQDwqLywyMQV0gGtKnZrmAtRvulg1d ilYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:sender:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aSrkxpA7geaX2vRJhurqbTURZUDXkhhsF1w6Cfguz9w=; b=iEUi6uRvP4RjSQ/ZkIozX4xgWpWIIS3LdzYihIMe6BsePqld6ObDmXXQdpXJRAjdnf dLV1962jHgs187Nny67qeLePnkwIGkgDVsWOdcU3sXy6zHubVaHgDPFeoaqVsk1ciHnC O+pb9Juf1pJQ87gFMKXGW6ZQakz/GplVq5FENW8JsIKt8JI18twUaaZT6PuU2A7hUQwu 6j7PzDkcXr7eKwt+AXmbQkteMBJLFkcICn1jXrl9R8bqwcTMs/UadCI71wGVHZNVEa8B Q6exoFcGuzfZFsel/Ej4UmwXBocUtiQTX6KjgnE65v5jHR/kqwaMl6S716TfIU6YpOdJ 4lMw== X-Gm-Message-State: AO0yUKVkeFNiDGgFqH/iJCgOVQd4xHn/VRtX1FvPDvzspkhGnULMfjJL rvKUz7ZmyMdSCjALOjF5sjhskJodVf2+fb4No9vyTDqMd4I= X-Google-Smtp-Source: AK7set8FgpeXOy/HaofoniWjv9ZMxgvM1LLksN0GQ0ZIDlp5hhhrHf6r2VDBTYUDNI0j71tNdmLqeqOx/GDwQa+FlF4= X-Received: by 2002:a05:6808:2022:b0:378:328b:821c with SMTP id q34-20020a056808202200b00378328b821cmr242806oiw.204.1676467376884; Wed, 15 Feb 2023 05:22:56 -0800 (PST) MIME-Version: 1.0 Sender: mathieu.gallissot@gmail.com X-Google-Sender-Delegation: mathieu.gallissot@gmail.com From: Ena Irtnanoelec Date: Wed, 15 Feb 2023 14:22:45 +0100 X-Google-Sender-Auth: Nc1gr3jQxT06PoHSzB7Tzk0DOok Message-ID: Subject: TemporaryBreakpoint and FInishingbreakpoint issues To: gdb@sourceware.org Content-Type: multipart/alternative; boundary="0000000000007a0fe005f4bcfa86" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000007a0fe005f4bcfa86 Content-Type: text/plain; charset="UTF-8" Dear all, I've got some troubles with both FinishingBreakpoint and TemporaryBreakpoints I'm trying to set using the Python's API. My use case is as follows : I've added some breakpoints on particular code of the linux kernel, on a syscall definition. This is the code in which I'm placing a BP: SYSCALL_DEFINE3 (execve , const char __user *, filename , const compat_uptr_t __user *, argv , const compat_uptr_t __user *, envp ){ return compat_do_execve (getname (filename ), argv , envp );} So far no problems, thus, once there, I would like to have the exit code of this function. This is where I have some difficulties. I first tried with a FinishingBreakpoint as follows. Thus, it never each the "normal finish" and always ends up in "out of scope", despite the fact it is placed at the correct place (in an assembly file - entry-common.S). When I'm manually stepping thru, I got there. class ExecveBreakpoint(gdb.Breakpoint): def stop(self): MyFinishBreakpoint(gdb.selected_frame()) class MyFinishBreakpoint (gdb.FinishBreakpoint): def stop (self): print ("normal finish") def out_of_scope (): print ("abnormal finish") I was wondering if this was because there were no ret instruction at the end of the block ? Anyway, I've tried to get around by computing the last instruction before continuing in assembly pc = gdb.selected_frame().pc() addr = gdb.block_for_pc(pc).end addr = addr - \ gdb.selected_frame().architecture().disassemble(addr)[0][ 'length'] TestBp(f"*0x{addr:02x}", temporary=True) class TestBp(gdb.Breakpoint): def stop(self): print(f"count = {self.hit_count}") #self.delete()# <- this crashed gdb return False It happens that even though I made it temporary, it is never deleted. Furthermore, the hit_count is always 0 even though I've got multiple print calls on the console. Any idea ? Kind regards, Mathieu --0000000000007a0fe005f4bcfa86--