From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13758 invoked by alias); 1 Apr 2004 00:11:09 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13751 invoked from network); 1 Apr 2004 00:11:07 -0000 Received: from unknown (HELO esds.vss.fsi.com) (66.136.174.212) by sources.redhat.com with SMTP; 1 Apr 2004 00:11:07 -0000 Received: from thing1.vss.fsi.com (thing1.vss.fsi.com [198.51.29.21]) by esds.vss.fsi.com (8.11.6+Sun/8.9.1) with ESMTP id i310B6W01711 for ; Wed, 31 Mar 2004 18:11:06 -0600 (CST) Received: from localhost (ford@localhost) by thing1.vss.fsi.com (8.11.6+Sun/8.11.6) with ESMTP id i310B6L00529 for ; Wed, 31 Mar 2004 18:11:06 -0600 (CST) X-Authentication-Warning: thing1-200.fsi.com: ford owned process doing -bs Date: Thu, 01 Apr 2004 00:11:00 -0000 From: Brian Ford X-X-Sender: ford@thing1-200 To: gdb-patches@sources.redhat.com Subject: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp) Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1109389944-1080778266=:21204" X-SW-Source: 2004-04/txt/msg00000.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---559023410-1109389944-1080778266=:21204 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-length: 2195 I noticed this while tracking down another problem with adding DWARF2 support to Cygwin. (Jim Blandy knows which one. Thanks again Jim :^), and this is not necessarily related to that.) In gcc/config/i386/i386.c, we have: /* The "default" register map used in 32bit mode. */ int const dbx_register_map[FIRST_PSEUDO_REGISTER] = { 0, 2, 1, 3, 6, 7, 4, 5, /* general regs */ 12, 13, 14, 15, 16, 17, 18, 19, /* fp regs */ -1, -1, -1, -1, -1, /* arg, flags, fpsr, dir, frame */ 21, 22, 23, 24, 25, 26, 27, 28, /* SSE */ 29, 30, 31, 32, 33, 34, 35, 36, /* MMX */ -1, -1, -1, -1, -1, -1, -1, -1, /* extended integer registers */ -1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */ }; and: /* Define the register numbers to be used in Dwarf debugging information. */ int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER] = { 0, 2, 1, 3, 6, 7, 5, 4, /* general regs */ 11, 12, 13, 14, 15, 16, 17, 18, /* fp regs */ -1, 9, -1, -1, -1, /* arg, flags, fpsr, dir, frame */ 21, 22, 23, 24, 25, 26, 27, 28, /* SSE registers */ 29, 30, 31, 32, 33, 34, 35, 36, /* MMX registers */ -1, -1, -1, -1, -1, -1, -1, -1, /* extended integer registers */ -1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */ }; Notice that gcc regno 6 (ebp) and 7 (esp) map to regno 4 and 5 respectively in the "default" (aka dbx, stabs, sdb) table. But, in the svr4 (aka dwarf, dwarf2, stabs-in-elf) table, they map to regno 5 and 4 respectively. I'm not sure if/how this should affect i386_register_names. I also hope that targets have not already coded around this bug so that fixing it will break something else :-). Please do have a look at these issues before applying the patch. I'm afraid they are over my head right now. Thanks. 2004-03-31 Brian Ford * i386-tdep.c (i386_stab_reg_to_regnum): Reverse 4 and 5 (ebp and esp respectively) to match the gdb/DWARF regnums. -- Brian Ford Senior Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International Phone: 314-551-8460 Fax: 314-551-8444 ---559023410-1109389944-1080778266=:21204 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="i386-tdep.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="i386-tdep.patch" Content-length: 981 SW5kZXg6IGkzODYtdGRlcC5jDQo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQpS Q1MgZmlsZTogL2N2cy9zcmMvc3JjL2dkYi9pMzg2LXRkZXAuYyx2DQpyZXRy aWV2aW5nIHJldmlzaW9uIDEuMTgxDQpkaWZmIC11IC1wIC1yMS4xODEgaTM4 Ni10ZGVwLmMNCi0tLSBpMzg2LXRkZXAuYwkyMyBNYXIgMjAwNCAxNDo0Nzo1 NiAtMDAwMAkxLjE4MQ0KKysrIGkzODYtdGRlcC5jCTMxIE1hciAyMDA0IDIz OjI1OjUyIC0wMDAwDQpAQCAtMTc1LDggKzE3NSwxMCBAQCBpMzg2X3N0YWJf cmVnX3RvX3JlZ251bSAoaW50IHJlZykNCiAgIC8qIFRoaXMgaW1wbGVtZW50 cyB3aGF0IEdDQyBjYWxscyB0aGUgImRlZmF1bHQiIHJlZ2lzdGVyIG1hcC4g ICovDQogICBpZiAocmVnID49IDAgJiYgcmVnIDw9IDcpDQogICAgIHsNCi0g ICAgICAvKiBHZW5lcmFsLXB1cnBvc2UgcmVnaXN0ZXJzLiAgKi8NCi0gICAg ICByZXR1cm4gcmVnOw0KKyAgICAgIC8qIEdlbmVyYWwtcHVycG9zZSByZWdp c3RlcnMuDQorCSBlYnAgYW5kIGVzcCAoNCwgNSkgYXJlIHJldmVyc2VkIHdp dGggcmVzcGVjdCB0byBnZGIgYW5kIERXQVJGLiAqLw0KKw0KKyAgICAgIHJl dHVybiAocmVnICYgNikgPT0gNCA/IHJlZyBeIDEgOiByZWc7DQogICAgIH0N CiAgIGVsc2UgaWYgKHJlZyA+PSAxMiAmJiByZWcgPD0gMTkpDQogICAgIHsN Cg== ---559023410-1109389944-1080778266=:21204--