From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36405 invoked by alias); 7 Feb 2020 22:02:38 -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 36213 invoked by uid 89); 7 Feb 2020 22:02:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Feb 2020 22:02:35 +0000 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id F07231E05A; Fri, 7 Feb 2020 17:02:33 -0500 (EST) Subject: Re: [PATCH 2/2] Use enums for human-readable exception information. To: Hannes Domani , gdb-patches@sourceware.org References: <20200117153140.2231-1-ssbssa@yahoo.de> <20200117153140.2231-2-ssbssa@yahoo.de> From: Simon Marchi Message-ID: <854a3dec-e7db-4ccd-eb63-bdebb6af5281@simark.ca> Date: Fri, 07 Feb 2020 22:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200117153140.2231-2-ssbssa@yahoo.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-02/txt/msg00193.txt.bz2 On 2020-01-17 10:31 a.m., Hannes Domani via gdb-patches wrote: > Changes to $_siginfo type to this: > > (gdb) pt $_siginfo > type = struct EXCEPTION_RECORD { > enum ExceptionCode ExceptionCode; > unsigned int ExceptionFlags; > struct EXCEPTION_RECORD *ExceptionRecord; > void *ExceptionAddress; > unsigned int NumberParameters; > union { > void *ExceptionInformation[15]; > struct {...} AccessViolationInformation; > }; > } > (gdb) pt $_siginfo.ExceptionCode > type = enum ExceptionCode {FATAL_APP_EXIT = 1073741845, > DBG_CONTROL_C = 1073807365, DBG_CONTROL_BREAK = 1073807368, > DATATYPE_MISALIGNMENT = 2147483650, BREAKPOINT, SINGLE_STEP, > ACCESS_VIOLATION = 3221225477, IN_PAGE_ERROR, > ILLEGAL_INSTRUCTION = 3221225501, NONCONTINUABLE_EXCEPTION = 3221225509, > INVALID_DISPOSITION, ARRAY_BOUNDS_EXCEEDED = 3221225612, > FLOAT_DENORMAL_OPERAND, FLOAT_DIVIDE_BY_ZERO, FLOAT_INEXACT_RESULT, > FLOAT_INVALID_OPERATION, FLOAT_OVERFLOW, FLOAT_STACK_CHECK, > FLOAT_UNDERFLOW, INTEGER_DIVIDE_BY_ZERO, INTEGER_OVERFLOW, > PRIV_INSTRUCTION, STACK_OVERFLOW = 3221225725, FAST_FAIL = 3221226505} > (gdb) pt $_siginfo.AccessViolationInformation > type = struct { > enum ViolationType Type; > void *Address; > } > (gdb) pt $_siginfo.AccessViolationInformation.Type > type = enum ViolationType {READ_ACCESS_VIOLATION, WRITE_ACCESS_VIOLATION, > DATA_EXECUTION_PREVENTION_VIOLATION = 8} > > Which makes it easier to understand the reason of the exception: > > (gdb) p $_siginfo > $1 = { > ExceptionCode = ACCESS_VIOLATION, > ExceptionFlags = 0, > ExceptionRecord = 0x0, > ExceptionAddress = 0x401632 , > NumberParameters = 2, > { > ExceptionInformation = {0x1, 0x123, 0x0 }, > AccessViolationInformation = { > Type = WRITE_ACCESS_VIOLATION, > Address = 0x123 > } > } > } Well, this kind of goes against the last comment I left on patch 1 (to use the actual types found in the real structure), but I think that what you are suggesting here is quite convenient, so I wouldn't be against doing something like that. Please add a bit of comments to your code to explain what you are doing. Since you are inventing types that don't exist in the documentation, it's not obvious to know what this is doing. Simon