From patchwork Thu Nov 3 00:37:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 17140 Received: (qmail 63744 invoked by alias); 3 Nov 2016 00:37:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 63730 invoked by uid 89); 3 Nov 2016 00:37:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, MIME_BASE64_BLANKS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=(unknown), H*MI:google, metal, H*MI:sk:94eb2c0 X-HELO: mail-pa0-f73.google.com Received: from mail-pa0-f73.google.com (HELO mail-pa0-f73.google.com) (209.85.220.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Nov 2016 00:37:30 +0000 Received: by mail-pa0-f73.google.com with SMTP id yw6so1321677pac.1 for ; Wed, 02 Nov 2016 17:37:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-transfer-encoding; bh=QMX0pNh3AOBMPKXEjLZTf0Glqru+dC2mYLt595HLNWg=; b=BQh0SQN8YWp6kV7hBtNTgCpPpBhycq02HMzr+Xg+1Tw6bFSWXel+YWvKP5eX6QVWnk sHcuxv84dYwAfxQ3hpbvzy971AJaiFRUR4JgCx60Riic0sL4LfUu22El6MsflN0UhAvy E/M43mOQ44z3Nn/UU7+c9XAG/XoJuJXOjMHjinZaLYJoK0dzDxY1Wt6m6h1xPbS8xKig F3gOAOQXTbiEFVw4x0uIrQ2oqwOb/4CvQG6aikJZ9Fjp9tq707Z5Vepz5J1NXBF87sv1 2s2KOqvdGvDIHY0uiaj7UyMolQ6eBNHZapcE6khtGNAR8RuWHiLy6hEij1WiaeXIDcoP 0IWQ== X-Gm-Message-State: ABUngvdCE09LQm8e13AxoGeT4zE9xVW2sQqTy+p7ZzRcCsJqwQf4MQhGqeeQOVefk20jfyGlKqp9LSPZNYclpFrcSU/02i9PmjkJbek8alFqg8Fb9bqRvHJnvocnEdmwcl3n+8Mm521M4LVKRVgmzOKyQUMmFsl/5i8KtffvC+Bn9S8vzcLYrw== MIME-Version: 1.0 X-Received: by 10.98.95.4 with SMTP id t4mr1826472pfb.15.1478133448843; Wed, 02 Nov 2016 17:37:28 -0700 (PDT) Message-ID: <94eb2c047d9c268cd705405ac313@google.com> Date: Thu, 03 Nov 2016 00:37:28 +0000 Subject: [PATCH] Add some clarifying comments to i386-tdep.c From: Doug Evans To: gdb-patches@sourceware.org X-IsSubscribed: yes Hi. I was debugging a bare metal x86 target and a part of gdb wasn't working as expected, and I found myself in the innards of the x86 port and wondering what's going on. This patch helps clarify what's going on here, at least for this reader. It'll certainly help me next time I'm in there. 2016-11-02 Doug Evans * i386-tdep.c (i386_gdbarch_init): Add comments. @@ -8562,7 +8564,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_insn_is_ret (gdbarch, i386_insn_is_ret); set_gdbarch_insn_is_jump (gdbarch, i386_insn_is_jump); - /* Hook in ABI-specific overrides, if they have been registered. */ + /* Hook in ABI-specific overrides, if they have been registered. + Note: If INFO specifies a 64 bit arch, this is where we turn + a 32-bit i386 into a 64-bit amd64. */ info.tdep_info = tdesc_data; gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index da8ff8e..60263cc 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -8320,6 +8320,8 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, } +/* Note: This is called for both i386 and amd64. */ + static struct gdbarch * i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { @@ -8337,7 +8339,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) if (arches != NULL) return arches->gdbarch; - /* Allocate space for the new architecture. */ + /* Allocate space for the new architecture. Assume i386 for now. */ tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep);