From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49916 invoked by alias); 25 Jan 2017 08:38:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 49894 invoked by uid 89); 25 Jan 2017 08:38:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=fexceptions, H*MI:sk:1484560, H*RU:74.125.83.67, Hx-spam-relays-external:74.125.83.67 X-HELO: mail-pg0-f67.google.com Received: from mail-pg0-f67.google.com (HELO mail-pg0-f67.google.com) (74.125.83.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Jan 2017 08:38:20 +0000 Received: by mail-pg0-f67.google.com with SMTP id 194so19103834pgd.0 for ; Wed, 25 Jan 2017 00:38:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=iVla+STiEIavePywmxadQIzgxUMgX+QFhnstYULLnO4=; b=Tii3REe9T9lsqo4eZanAp1jajiEEkTyFH6ydbh82TnUIrOYWF7zp4sJ+jTs9Zd/ioA qO2/EyzFVNP9g6DXVJ2UT31bO7cHgRUI9ug4eHUaEvupIQQiwYq/pYwyuY5rfpWlyCvb UHqPUQM62+tRYSq7E+9Rwg2LiPkGOsaqMT0jKb8or6pCLhJU71NP+EDFlBz3ARH7exty 3OQEdbDDT0Y7hOCC7i32Y93pWzoPosuQ0yeUiUz+hiqiPHp19WKHeKOmJVKGyClChjn6 MNq9IbU6HntqMpoWeSmvJmULz0MjP1UwOyJHL2uKnU8nD9OQSjgt2sQr4x/7bS1ZUh6F 59sQ== X-Gm-Message-State: AIkVDXICm5XEicB+RO5yyVMk0SAkEGsqUTKPWBj9L8pFfzi2QMohKUcab41x4789MbZzGA== X-Received: by 10.84.241.1 with SMTP id a1mr1789932pll.65.1485333499170; Wed, 25 Jan 2017 00:38:19 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id x2sm50271378pfa.71.2017.01.25.00.38.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 00:38:18 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 0/6 v3] Handle memory error on disassembly Date: Wed, 25 Jan 2017 08:38:00 -0000 Message-Id: <1485333480-20515-1-git-send-email-yao.qi@linaro.org> In-Reply-To: <1484560977-8693-1-git-send-email-yao.qi@linaro.org> References: <1484560977-8693-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00512.txt.bz2 Hi, Nowadays, we can set function pointer disassemble_info.memory_error_func to throw error or exception when disassembler gets an error, and the caller can/may catch the exception. Both gdb and objdump use this interface for many years. After GDB is switched to C++, this stops working due to the "foreign frame" from opcodes. That is to say, a C++ program calls a C function (print_insn_XXX from opcodes) and this function calls a C++ code which throws exception. DW2 C++ exception unwinder can unwind across the C function frame, unless the C code is compiled with -fexceptions. As a result, GDB aborts on memory error during disassembly on some hosts. This is the v3 of the patch series, and V2 can be found https://sourceware.org/ml/gdb-patches/2017-01/msg00288.html V3 addressed all comments on function names and code comments in V2. *** BLURB HERE *** Yao Qi (6): New function null_stream Refactor disassembly code Call print_insn_mep in mep_gdb_print_insn Disassembly unit test: disassemble one instruction Disassembly unit test: memory error Don't throw exception in dis_asm_memory_error gdb/Makefile.in | 5 + gdb/arm-tdep.c | 5 +- gdb/disasm-selftests.c | 221 ++++++++++++++++++++++++ gdb/disasm.c | 183 ++++++++++---------- gdb/disasm.h | 57 ++++-- gdb/guile/scm-disasm.c | 77 +++------ gdb/mep-tdep.c | 10 +- gdb/mips-tdep.c | 5 +- gdb/record-btrace.c | 5 +- gdb/selftest-arch.c | 102 +++++++++++ gdb/selftest-arch.h | 27 +++ gdb/spu-tdep.c | 20 +-- gdb/testsuite/gdb.base/all-architectures.exp.in | 5 + gdb/utils.c | 15 ++ gdb/utils.h | 3 + 15 files changed, 560 insertions(+), 180 deletions(-) create mode 100644 gdb/disasm-selftests.c create mode 100644 gdb/selftest-arch.c create mode 100644 gdb/selftest-arch.h -- 1.9.1