From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix M-x gdb when debugging over Tramp Date: Wed, 7 Apr 2021 16:14:35 -0700 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000bf05e305bf6a1819" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36008"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 08 03:10:52 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUJC7-0009G0-Sx for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Apr 2021 03:10:52 +0200 Original-Received: from localhost ([::1]:37508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUJC6-00083N-Mo for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Apr 2021 21:10:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUHNq-0001rQ-39 for emacs-devel@gnu.org; Wed, 07 Apr 2021 19:14:50 -0400 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:33339) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lUHNo-0001zV-9v for emacs-devel@gnu.org; Wed, 07 Apr 2021 19:14:49 -0400 Original-Received: by mail-pl1-x636.google.com with SMTP id p10so70451pld.0 for ; Wed, 07 Apr 2021 16:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Zt67mCSBGs/GmDc4E1fPHW5QlYjPw7Jaj/3wjdDKkAk=; b=f9ghhkeQAqAiI6qieFAoifK1Nok6Q/pke7jKlzlpdp7oYPn6KIdTCjJeoVQsV8rhkA q/BVN7zpwNkPbbfc3wW0oGFIjSfZ5wHSREyAT04u3hcDpfUUQhRZAuRwKSNCtlswzalz 8CogPXNyR6/4EJNmF9X+Mk33fKiJuF0xXnQx8WMilnW/ZYD17JhOCFPAh+dsmGDVL++z BSV9rRa6j2Xb9ZZqmGbqi3NBEr6BEWZdi+ATq8BHI3p0P0MJLx/bRtweuV1GBLSQzoVM D71dPWundJJidSVSkC5pEygeEvaJQn8nh9IqJsCReA6ud3EEkJUyFjt8UziptULzcSqC zRKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Zt67mCSBGs/GmDc4E1fPHW5QlYjPw7Jaj/3wjdDKkAk=; b=ZwS/0Ut5/nNSeafAyafxqOqmkud7Bku/JDvy/yfp6QrjQZa3JA0c8AXa1WTOgJZ+TK aBy1WaYkGyzqDfAS39EWyikCHOtIAdhBwGgIr6ybl92rGFpQrS6jtWJRdWAVt6nHaWgt NBIdME9BblzFx7Owxw2A/YVaZeeTvWD1ncpytBB0b+Unbk4Z8ToLhtaGGpXc5c7rFcP9 prJ6iefde3WS9NEk3FWsxBcGihngAMq2N/34JnbJJ5rlF/nn+dXRriZRffnADPilL59U IMDRRbvYYAAkGQlEBPZTUd+xQdLya5qG3TvGjzrPUL7746286PEMUezV66wPLVFsCAto KbNg== X-Gm-Message-State: AOAM533m+C09krrFUXUwKZcLr/v+57jVhhy9E7B+h/f7BlwnrLnd1ORn TpNp0+b9ZImbi7eG5eV61hPS95ONjRKFkoXNtbDCxKJhKiQ= X-Google-Smtp-Source: ABdhPJxkq5uEUOePnKaQszVvsdiw+wCLar/KVhrFDfdL5rmujwpvfI/Q5ZLixHSwBH+69wIqpN95ATdMeFMfqKDaRBY= X-Received: by 2002:a17:902:e8c1:b029:e9:3c98:2dd2 with SMTP id v1-20020a170902e8c1b02900e93c982dd2mr5039222plg.17.1617837286081; Wed, 07 Apr 2021 16:14:46 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 07 Apr 2021 21:09:47 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267592 Archived-At: --000000000000bf05e305bf6a1819 Content-Type: multipart/alternative; boundary="000000000000bf05e105bf6a1817" --000000000000bf05e105bf6a1817 Content-Type: text/plain; charset="UTF-8" Here's a pair of patches (one against the latest git revision, and one against the emacs-27 branch) to fix debugging via M-x gdb over Tramp. There were two problems: 1) In `gdb-jsonify-buffer', when replacing the "fullname" with a Tramp path, the wildcard was greedy, resulting in only one "fullname" being replaced. This had the effect of rendering it impossible to have more than one breakpoint, as all but the first breakpoint would have unmodified "fullname"s. This fix isn't needed for Emacs 28, since `gdb-jsonify-buffer' was replaced with a more-accurate parser for GDB/MI. 2) In `gdb-frame-handler', `gdb-selected-file' needs to be the *local* file path, since that's what `gud-last-frame' expects. Without this, the overlay arrow for the current line in the source buffer won't show. I've been running with these patches for a few months locally and haven't found any further issues. Note that I haven't filled out copyright assignment papers, but these patches are very small, so my understanding is that's not necessary. If you'd like me to fill them out, just let me know. - Jim --000000000000bf05e105bf6a1817 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here's a pair of patches (one against the latest = git revision, and one against the emacs-27 branch) to fix debugging via M-x= gdb over Tramp. There were two problems:

1) In `g= db-jsonify-buffer', when replacing the "fullname" with a Tram= p path, the wildcard was greedy, resulting in only one "fullname"= being replaced. This had the effect of rendering it impossible to have mor= e than one breakpoint, as all but the first breakpoint would have unmodifie= d "fullname"s. This fix isn't needed for Emacs 28, since `gdb= -jsonify-buffer' was replaced with a more-accurate parser for GDB/MI.

2) In `gdb-frame-handler', `gdb-selected-file&#= 39; needs to be the *local* file path, since that's what `gud-last-fram= e' expects. Without this, the overlay arrow for the current line in the= source buffer won't show.

I've been r= unning with these patches for a few months locally and haven't found an= y further issues. Note that I haven't filled out copyright assignment p= apers, but these patches are very small, so my understanding is that's = not necessary. If you'd like me to fill them out, just let me know.

- Jim
--000000000000bf05e105bf6a1817-- --000000000000bf05e305bf6a1819 Content-Type: application/octet-stream; name="0001-Emacs27-Fix-GDB-MI-usage-when-debugging-over-Tramp.patch" Content-Disposition: attachment; filename="0001-Emacs27-Fix-GDB-MI-usage-when-debugging-over-Tramp.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kn82i3qf0 RnJvbSA1ZTExZWM0MzYyYzZiNTY0NjY0Nzc1MzZhYzEyMjllZTJiOGI4ZmNjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5jb20+CkRh dGU6IFdlZCwgNyBBcHIgMjAyMSAxNTo1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wgdCkKKyAgICAgICAgKHdoaWxlIChyZS1zZWFyY2gtZm9yd2FyZCAi W1xcWyxdZnVsbG5hbWU9XCJcXCguKz9cXClcIiIgbmlsIHQpCiAgICAgICAgICAgKHJlcGxhY2Ut bWF0Y2ggKGNvbmNhdCByZW1vdGUgIlxcMSIpIG5pbCBuaWwgbmlsIDEpKSkpCiAgICAgKGdvdG8t Y2hhciAocG9pbnQtbWluKSkKICAgICAod2hlbiBmaXgta2V5CkBAIC00Mzc2LDcgKzQzNzYsNyBA QCBvdmVybGF5IGFycm93IGluIHNvdXJjZSBidWZmZXIuIgogICAobGV0ICgoZnJhbWUgKGJpbmRh dC1nZXQtZmllbGQgKGdkYi1qc29uLXBhcnRpYWwtb3V0cHV0KSAnZnJhbWUpKSkKICAgICAod2hl biBmcmFtZQogICAgICAgKHNldHEgZ2RiLXNlbGVjdGVkLWZyYW1lIChiaW5kYXQtZ2V0LWZpZWxk IGZyYW1lICdmdW5jKSkKLSAgICAgIChzZXRxIGdkYi1zZWxlY3RlZC1maWxlIChiaW5kYXQtZ2V0 LWZpZWxkIGZyYW1lICdmdWxsbmFtZSkpCisgICAgICAoc2V0cSBnZGItc2VsZWN0ZWQtZmlsZSAo ZmlsZS1sb2NhbC1uYW1lIChiaW5kYXQtZ2V0LWZpZWxkIGZyYW1lICdmdWxsbmFtZSkpKQogICAg ICAgKHNldHEgZ2RiLWZyYW1lLW51bWJlciAoYmluZGF0LWdldC1maWVsZCBmcmFtZSAnbGV2ZWwp KQogICAgICAgKHNldHEgZ2RiLWZyYW1lLWFkZHJlc3MgKGJpbmRhdC1nZXQtZmllbGQgZnJhbWUg J2FkZHIpKQogICAgICAgKGxldCAoKGxpbmUgKGJpbmRhdC1nZXQtZmllbGQgZnJhbWUgJ2xpbmUp KSkKLS0gCjIuMjUuMQoK --000000000000bf05e305bf6a1819 Content-Type: application/octet-stream; name="0001-Emacs28-Fix-GUD-overlay-arrows-in-gdb-mi-when-debugging-over.patch" Content-Disposition: attachment;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