From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic306-19.consmr.mail.ir2.yahoo.com (sonic306-19.consmr.mail.ir2.yahoo.com [77.238.176.205]) by sourceware.org (Postfix) with ESMTPS id 996FE3857C73 for ; Mon, 5 Oct 2020 11:23:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 996FE3857C73 X-YMail-OSG: Dj1JVREVM1nc2VPcey7zwxFfuBrtuepKrX6kLzUGqvmAiiEBc3l6xXfymOG0VpH 1EQ.w8gZx6579AXXqalh_EgkPaEQS.RnxCv7bXptcjtqYi02O3Hc1yTrLwYMnXZRgt5LDE2ZVUvm SOaUc3jburBeYKIRFaOGr.R_84qx8uRoOUQbQ6CQGlDJzXUzEEG_vKuIDQlEVZHjw3yXkVqtkHIp JhSKp2453NCptBywLHaXJnGGoKfHtE35uvQWhQ.XfS50UuUCB1mOCkIPNuiuRgm745KPP_kCvpOe aBoTYWDK9WjtLxWPQime0an.eHmY_ID_SEfrPUqwEd.lkcL70dELnFL1brmZC8LDKTO1RBQOYkG5 zwKQHHPA9hjhDPo7UHkfTh0W5V2.zrQJ8EU7RvUReCwb9DlWZtlXUrkfU1XUoA.izNpWQxQA5U6C zQ68ELEbp4mQHlJaC9nE6FcHqs7hqrlw3fsz20uuZhtVIOYwEU39mtb7kZPzehzq.FVa5A9KuaTw MqCyofJwzZyIHfonYeD9kDXCjuYtHiEDdCgYa5nkCton5wcNL6QQUR1okEDeK8P7rJzr5xM46mZ8 hr0yzazKwwekdWw6CYHCwAw1m1Jz2rRJ7QcPgFvN1WLgX95tkYe9xmLsXwPtWa4JKe3k9IgmBnif Vy7cJUVR8N_qE01wKYna3fN3N2trHVSjC9mFm85TD00nJ6n0fRq8SCrcOeB5Qcy4rK38phPVnqKH uz6RGm8ce0c2y3TDF60blo_naOxkJ94DU1efK050nhOEUsCKLOByoDbMeOV5ZVUykYvU2FPXFyxs AwRQdzl.Ejvtxf9oK.7FrUpsmNakMyGCL5_JQvrpPjyJzFA_KT_yWKqHl8RBO5lWQ116G8yCA9eW cwLLhKbkWipzusgXwQXOVW9Ww8JplCmzMFsQzuoMpRH6FxHX54g7GOiR5D.zzY6kv2w75.AaSdGx dtslb6vhLU2SgdcjkumY4I9o7uznP79TjP_fVVMivSW4wVEYR1uM.MhGzf2d8DyNHUv0to3rqT5E KUkciyfuVwfafVt_y9fGKHtPfap_1h5T790ODNdOzJNtFCc_lYULkmN6vtOlB4jG60WfogYtdK75 4LOV0CWjQ7jfcqgrKu8ARlo713soXWHvtokHuF5XBcZFmAIQTuXL06Fn5ontp3cAW19lNS3BpZp0 gw6e85WFelFqDhPbmhWG85R3viXbfkEyoN3wAjHYmRWDaQX1xfT9BQTD24i_aE7krGrxM67c3_aR 1blB06rdqoKm3BX7fNEbAmt3ijOw1cweofeWj37gB89HFzF7i7a34B4irHUiBHRIpxXvbx9toTL0 oIoCzkS1ysALR0aQ6wiQt8QpPsNquJwU3AN_OvFUQL3U_LubkDD4JebV6rmkceOXV.Xf27u3IbLu jKPwQzXlKt_7uoxs5DpeGXaR98.P38S6Th7ZHIrYko5bdLSeLyImvFUvkrUxtaEqDekBLTsi1GS5 PpZ5lbGu6 Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Mon, 5 Oct 2020 11:23:13 +0000 Date: Mon, 5 Oct 2020 11:23:12 +0000 (UTC) From: Hannes Domani To: "gdb-patches@sourceware.org" , Simon Marchi Message-ID: <795027772.3069099.1601896992593@mail.yahoo.com> In-Reply-To: <1cfd024c-3ef9-8dd4-a449-c6cba35a10eb@simark.ca> References: <20200529150800.2013-1-ssbssa@yahoo.de> <20200529150800.2013-2-ssbssa@yahoo.de> <1cfd024c-3ef9-8dd4-a449-c6cba35a10eb@simark.ca> Subject: Re: [PATCH 2/2] Handle Windows drives in auto-load script paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.16718 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2020 11:23:16 -0000 Am Montag, 5. Oktober 2020, 04:06:31 MESZ hat Simon Marchi Folgendes geschrieben: > Hi Hannes, > > On 2020-05-29 11:08 a.m., Hannes Domani via Gdb-patches wrote: > > Fixes this testsuite fail on Windows: > > FAIL: gdb.base/auto-load.exp: print $script_loaded > > > > Converts the debugfile path from c:/dir/file to /c/dir/file, so it can = be > > appended to the auto-load path. > > > > gdb/ChangeLog: > > > > 2020-05-29=C2=A0 Hannes Domani=C2=A0 > > > >=C2=A0=C2=A0=C2=A0=C2=A0 * auto-load.c (auto_load_objfile_script_1): Con= vert drive part > >=C2=A0=C2=A0=C2=A0=C2=A0 of debugfile path on Windows. > > > > gdb/doc/ChangeLog: > > > > 2020-05-29=C2=A0 Hannes Domani=C2=A0 > > > >=C2=A0=C2=A0=C2=A0=C2=A0 * gdb.texinfo: Document Windows drive conversio= n of > >=C2=A0=C2=A0=C2=A0=C2=A0 'set auto-load scripts-directory'. > > --- > > v2: > > - Document Windows drive conversion of 'set auto-load scripts-directory= '. > > --- > >=C2=A0 gdb/auto-load.c=C2=A0=C2=A0=C2=A0 | 7 +++++++ > >=C2=A0 gdb/doc/gdb.texinfo | 4 ++++ > >=C2=A0 2 files changed, 11 insertions(+) > > > > diff --git a/gdb/auto-load.c b/gdb/auto-load.c > > index 99bd96b971..88221d9f3d 100644 > > --- a/gdb/auto-load.c > > +++ b/gdb/auto-load.c > > @@ -784,6 +784,13 @@ auto_load_objfile_script_1 (struct objfile *objfil= e, const char *realname, > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "scripts= -directory' path \"%s\".\n"), > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 auto_load_dir); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Convert Windows debugfile path from = c:/dir/file to /c/dir/file.=C2=A0 */ > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (HAS_DRIVE_SPEC (debugfile)) > > +=C2=A0=C2=A0=C2=A0 { > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 debugfile_holder =3D STRIP_DRIVE_SPEC (= debugfile); > > I looked at this patch a bit before realizing it is already merged.=C2=A0= I > was going to make a comment about the line above, so I made it a patch > instead, WDYT? Eli later noticed this problem as well, in this thread: https://sourceware.org/pipermail/gdb-patches/2020-July/170204.html > From 602e996b26d592ecda500ed64adafac30e0e9ce7 Mon Sep 17 00:00:00 2001 > From: Simon Marchi > Date: Sun, 4 Oct 2020 22:00:17 -0400 > Subject: [PATCH] gdb: avoid unnecessary string copy in > auto_load_objfile_script_1 > > Assigning the result of STRIP_DRIVE_SPEC to an std::string creates an > unnecessary copy of the string.=C2=A0 STRIP_DRIVE_SPEC is defined as: > >=C2=A0=C2=A0 #define STRIP_DRIVE_SPEC(f) ((f) + 2) > > So if it is passed a "const char *", it returns a "const char *".=C2=A0 W= e > could use a "const char *" intermediary variable instead of an > std::string, or (as implemented in this patch) just use it directly in > the concatenation right after. > > gdb/ChangeLog: > >=C2=A0=C2=A0=C2=A0=C2=A0 * auto-load.c (auto_load_objfile_script_1): Don't= use >=C2=A0=C2=A0=C2=A0=C2=A0 debugfile_holder as temporary variable when strip= ping drive >=C2=A0=C2=A0=C2=A0=C2=A0 letter. > > Change-Id: If2ccc7a156b22100754d9cdf6778ac7eeb93da4c > --- > gdb/auto-load.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/gdb/auto-load.c b/gdb/auto-load.c > index 9a51d2f3dc6c..43d007ca5b03 100644 > --- a/gdb/auto-load.c > +++ b/gdb/auto-load.c > @@ -777,10 +777,8 @@ auto_load_objfile_script_1 (struct objfile *objfile,= const char *realname, > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Convert Windows file name from c:/= dir/file to /c/dir/file.=C2=A0 */ >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (HAS_DRIVE_SPEC (debugfile)) > -=C2=A0=C2=A0=C2=A0 { > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 debugfile_holder =3D STRIP_DRIVE_SPEC (de= bugfile); > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 filename =3D std::string("\\") + debugfil= e[0] + debugfile_holder; > -=C2=A0=C2=A0=C2=A0 } > +=C2=A0=C2=A0=C2=A0 filename =3D (std::string("\\") + debugfile[0] > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 + STR= IP_DRIVE_SPEC (debugfile)); > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (const gdb::unique_xmalloc_ptr &dir : vec) > >=C2=A0=C2=A0=C2=A0=C2=A0 { > -- > 2.28.0 Ummm, LGTM. Hannes