From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 040363857031 for ; Wed, 1 Jul 2020 12:26:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 040363857031 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=undo.io Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=etesta@undo-software.com Received: by mail-wr1-x42f.google.com with SMTP id z15so12326834wrl.8 for ; Wed, 01 Jul 2020 05:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=undo.io; s=google; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=NDvz5pGsyuRjdXFTuF/NaC343/1p9sRFB/xD7pJNTfs=; b=PpYhO2uQCze2yzLqf1b/iibkR7ebe1rssiFV4BT7Mz6xsKMU8K6T4kqvHJ79yhS9/F arnezDmvXX/ga1lPb9xBvrpLC3onNC/disQQm3P+0R9RPft0cLtTssdbi3grWHiHFnm6 I3O2XMyS9rWbVhPpBE36sQr/yYliJ5Km7lTRV/IcNSO5Jxm1khqQECnv2w/3Eyc025jw HsMNw+FZbH8OqIDzgm0OUYbbMx1+loHmgp25cEE3NeS940aFvwQgA3LA9ooPGEIBragj HY8eucXr1CRYKJbmvnTpBlKQGGkVS/WC2myjm35CKLc3SdRbZNnbKF75wIiobZOBfIyY w0gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=NDvz5pGsyuRjdXFTuF/NaC343/1p9sRFB/xD7pJNTfs=; b=Xr22AkkixENUrP4llm1xQBo7YpiEHNOsVX24Nro3RNBZJeTm+XCOy0CpQ/02Kta9Th l67qD1buaScXgugJCaGM7fLq4OOK0LyR9n5fCsAG44AWkW52Xjpw2Sltdi9GvjIffsq1 /5PdYj1VhmGkvOgOcqgGj2D+z7o4U5vQmL1hJeH7gbvwWKASC9bPAkLv62I/TtrlhfmS YZI2xe2LF43WGMWOvbGWo8vhLs3PHDBJh20Fx0v5zpLGj6dXuJ6rvnGZuPlnICHy3mOk m2OXK8xqorx2Nsxm/om/vxa/w8mTh2+cGZXCJMZ2o98ncc5v/w2zg5wVbEi3CgNZ5w8z yR1A== X-Gm-Message-State: AOAM531i8HW7QqmwnyeKTw972xnbGtyo2yNNhsz1RMi0XrrtqAzqpYV2 pi2TyabwxvmLEnBCfuMFSodwr4EcJqFQlxE0bf/TpSo8hWLO/QtVeimW6ILr6i/jot6iPB3+3sp +jcQRb6Y9WcXqsIN1gi3sw9Q2de0SnA+tLAZJHBYoGigkd2CURj3Ks2HX/xR2MKD+H2f6 X-Google-Smtp-Source: ABdhPJw+7gTlz4eDzXg9iCHMmoF0tADtK4Z9CJohcl8/3sgt6yEnNfFE5itOm//qcULvAxcORdp2ww== X-Received: by 2002:adf:e60e:: with SMTP id p14mr25885389wrm.31.1593606400608; Wed, 01 Jul 2020 05:26:40 -0700 (PDT) Received: from [192.168.86.155] ([176.254.42.197]) by smtp.gmail.com with ESMTPSA id w2sm7520960wrs.77.2020.07.01.05.26.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2020 05:26:40 -0700 (PDT) To: gdb@sourceware.org From: Emiliano Testa Subject: python interface gdb.execute() to_string is useless Message-ID: Date: Wed, 1 Jul 2020 13:26:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Wed, 01 Jul 2020 12:26:43 -0000 Hello, I'm using the gdb APIs to implement a command and I want to control when the output of a certain command is sent to the console. To this end I'm using s = gdb.execute(cmd, to_string=True) unfortunately it doesn't seem to do what is says it would: I can see s is not None when to_string=True BUT it doesn't contain the output that it should. It went to the console instead. I think this is a bug. Many thanks Emiliano The output I get (gdb version is "GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git"): (gdb) python >print ("Before") >s = gdb.execute("continue", to_string=True) >print ("After") >print (s) >end Before loop_then_segv.c: i=0 loop_then_segv.c: i=1 loop_then_segv.c: i=2 loop_then_segv.c: i=3 loop_then_segv.c: i=4 loop_then_segv.c: i=5 loop_then_segv.c: i=6 loop_then_segv.c: i=7 loop_then_segv.c: i=8 loop_then_segv.c: i=9 causing deliberate segv pid=11290. Program received signal SIGSEGV, Segmentation fault. 0x0804855c in main () at tests/test/generic/loop_then_segv.c:26 26          *(volatile int*)NULL = 0; After (gdb) python >print ("Before") >s = gdb.execute("continue", to_string=False) >print ("After") >print (s) >end Before Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. After None (gdb) -- Emiliano Testa | Software Engineer | Direct: (+44)7512468305 | etesta@undo.io Undo | Accelerate software defect resolution by eliminating the guesswork in failure diagnosis CI Best Practice: Go Green, Stay Green