unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to make gdb debug mode work with tramp?
@ 2017-09-03 14:10 Zhongwei Yao
  2017-09-05  6:39 ` Zhongwei Yao
  2017-09-05 14:36 ` Michael Albinus
  0 siblings, 2 replies; 10+ messages in thread
From: Zhongwei Yao @ 2017-09-03 14:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, all,

I try to use 'M-x gdb' on Mac with tramp. But it runs into varies errors.

Here are some details:

Environment:
emacs 25.1.1 runs on Mac with tramp 2.2.13.25.1. And I have a test project
on a raspberry pi directory: /home/xxx/project/test_gdb/. It has a simple
file: test.c. test.c is compiled by gcc with -O0 -g to test_bin.

test.c:
1 int foo(int a, int b) {
2  int c = a + b;
3  return c;
4 }
5
6 int main(void) {
7  return foo(3, 4);
8 }

Steps:
1. Open test.c on raspberry pi in emacs
2. run 'M-x gdb'  gdb -i=mi test_bin and open gdb-many-window mode.
3. In *gud-test* buffer, run: break 7

Then I get an error in emacs Message:
File /scp:xxx@my-rasp-pi:/home/xxx/project/test_gdb/"/home/xxx/project/test_gdb/test.c"
no longer exists!

And in *gud-test* buffer, it prints following:
=== gud-test content start ===
96   Breakpoint 1 at 0x103c4: file test.c, line 7.
97   (gdb) list test.c:1
98   1 int foo(int a, int b) {
99   2  int c = a + b;
100 3  return c;
101 4 }
102 5
103 6 int main(void) {
104 7  return foo(3, 4);
105 8 }
=== gud-test content end ===

line 96 is OK, but I don't know why it prints line 97 to 105. I have not
typed any 'list' command. And it has set a break point on line 7.

4. I continue to run some debug command like: continue, but *gud-test*
buffer stucks until I type "Ctrl+g".

I don't know which part causes such error, gud-mode, tramp-mode or
something else and how to fix it.

Thanks for any suggestion!
--
Regards,
Zhongwei


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-03 14:10 How to make gdb debug mode work with tramp? Zhongwei Yao
@ 2017-09-05  6:39 ` Zhongwei Yao
  2017-09-05 14:36 ` Michael Albinus
  1 sibling, 0 replies; 10+ messages in thread
From: Zhongwei Yao @ 2017-09-05  6:39 UTC (permalink / raw)
  To: help-gnu-emacs

I fall back to gud-gdb and it can work. However, many features of gdb-mi
are gone.

On Sun, Sep 3, 2017 at 10:10 PM, Zhongwei Yao <ashi08104@gmail.com> wrote:

> Hi, all,
>
> I try to use 'M-x gdb' on Mac with tramp. But it runs into varies errors.
>
> Here are some details:
>
> Environment:
> emacs 25.1.1 runs on Mac with tramp 2.2.13.25.1. And I have a test project
> on a raspberry pi directory: /home/xxx/project/test_gdb/. It has a simple
> file: test.c. test.c is compiled by gcc with -O0 -g to test_bin.
>
> test.c:
> 1 int foo(int a, int b) {
> 2  int c = a + b;
> 3  return c;
> 4 }
> 5
> 6 int main(void) {
> 7  return foo(3, 4);
> 8 }
>
> Steps:
> 1. Open test.c on raspberry pi in emacs
> 2. run 'M-x gdb'  gdb -i=mi test_bin and open gdb-many-window mode.
> 3. In *gud-test* buffer, run: break 7
>
> Then I get an error in emacs Message:
> File /scp:xxx@my-rasp-pi:/home/xxx/project/test_gdb/"/home/xxx/project/test_gdb/test.c"
> no longer exists!
>
> And in *gud-test* buffer, it prints following:
> === gud-test content start ===
> 96   Breakpoint 1 at 0x103c4: file test.c, line 7.
> 97   (gdb) list test.c:1
> 98   1 int foo(int a, int b) {
> 99   2  int c = a + b;
> 100 3  return c;
> 101 4 }
> 102 5
> 103 6 int main(void) {
> 104 7  return foo(3, 4);
> 105 8 }
> === gud-test content end ===
>
> line 96 is OK, but I don't know why it prints line 97 to 105. I have not
> typed any 'list' command. And it has set a break point on line 7.
>
> 4. I continue to run some debug command like: continue, but *gud-test*
> buffer stucks until I type "Ctrl+g".
>
> I don't know which part causes such error, gud-mode, tramp-mode or
> something else and how to fix it.
>
> Thanks for any suggestion!
> --
> Regards,
> Zhongwei
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-03 14:10 How to make gdb debug mode work with tramp? Zhongwei Yao
  2017-09-05  6:39 ` Zhongwei Yao
@ 2017-09-05 14:36 ` Michael Albinus
  2017-09-05 15:43   ` Glenn Morris
  1 sibling, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2017-09-05 14:36 UTC (permalink / raw)
  To: Zhongwei Yao; +Cc: help-gnu-emacs

Zhongwei Yao <ashi08104@gmail.com> writes:

> Hi, all,

Hi Zhongwei,

> I try to use 'M-x gdb' on Mac with tramp. But it runs into varies errors.
>
> Here are some details:
>
> Environment:
> emacs 25.1.1 runs on Mac with tramp 2.2.13.25.1. And I have a test project
> on a raspberry pi directory: /home/xxx/project/test_gdb/. It has a simple
> file: test.c. test.c is compiled by gcc with -O0 -g to test_bin.
>
> test.c:
> 1 int foo(int a, int b) {
> 2  int c = a + b;
> 3  return c;
> 4 }
> 5
> 6 int main(void) {
> 7  return foo(3, 4);
> 8 }
>
> Steps:
> 1. Open test.c on raspberry pi in emacs
> 2. run 'M-x gdb'  gdb -i=mi test_bin and open gdb-many-window mode.
> 3. In *gud-test* buffer, run: break 7
>
> Then I get an error in emacs Message:
> File /scp:xxx@my-rasp-pi:/home/xxx/project/test_gdb/"/home/xxx/project/test_gdb/test.c"
> no longer exists!

This looks to me like the Emacs bug <https://debbugs.gnu.org/23608>. It
is reported as solved in Emacs 25.2.

Do you have a chance to check it there?

> Regards,
> Zhongwei

Best regards, Michael.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-05 14:36 ` Michael Albinus
@ 2017-09-05 15:43   ` Glenn Morris
  2017-09-05 19:31     ` Mario Castelán Castro
  2017-09-06  7:50     ` Michael Albinus
  0 siblings, 2 replies; 10+ messages in thread
From: Glenn Morris @ 2017-09-05 15:43 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Michael Albinus wrote:

> This looks to me like the Emacs bug <https://debbugs.gnu.org/23608>. It
> is reported as solved in Emacs 25.2.

I believe that was before 25.2 was released, and before renumbering
occurred. It is actually marked as fixed in 26.1, ie not yet fixed in
any release.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-05 15:43   ` Glenn Morris
@ 2017-09-05 19:31     ` Mario Castelán Castro
  2017-09-05 22:13       ` Glenn Morris
  2017-09-06  7:50     ` Michael Albinus
  1 sibling, 1 reply; 10+ messages in thread
From: Mario Castelán Castro @ 2017-09-05 19:31 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

On 05/09/17 10:43, Glenn Morris wrote:
> I believe that was before 25.2 was released, and before renumbering
> occurred. […]

Which renumbering?

-- 
Do not eat animals; respect them as you respect people.
https://duckduckgo.com/?q=how+to+(become+OR+eat)+vegan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-05 19:31     ` Mario Castelán Castro
@ 2017-09-05 22:13       ` Glenn Morris
  0 siblings, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2017-09-05 22:13 UTC (permalink / raw)
  To: Mario Castelán Castro; +Cc: help-gnu-emacs

Mario Castelán Castro wrote:

> On 05/09/17 10:43, Glenn Morris wrote:
>> I believe that was before 25.2 was released, and before renumbering
>> occurred. […]
>
> Which renumbering?

This commit
http://lists.gnu.org/archive/html/emacs-diffs/2016-09/msg00148.html

changed the release targeted by Emacs's master branch from 25.2 to 25.3.
It was then changed again to 26.1 in

http://lists.gnu.org/archive/html/emacs-diffs/2016-10/msg00001.html

(I've said several times that it would be better if Emacs release
numbers were predictable, to avoid precisely this kind of confusion
http://lists.gnu.org/archive/html/emacs-devel/2016-11/msg00238.html
)



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-05 15:43   ` Glenn Morris
  2017-09-05 19:31     ` Mario Castelán Castro
@ 2017-09-06  7:50     ` Michael Albinus
  2017-09-06 15:13       ` Zhongwei Yao
  1 sibling, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2017-09-06  7:50 UTC (permalink / raw)
  To: Glenn Morris; +Cc: help-gnu-emacs

Glenn Morris <rgm@gnu.org> writes:

>> This looks to me like the Emacs bug <https://debbugs.gnu.org/23608>. It
>> is reported as solved in Emacs 25.2.
>
> I believe that was before 25.2 was released, and before renumbering
> occurred. It is actually marked as fixed in 26.1, ie not yet fixed in
> any release.

Indeed.

The bug report contains the applied patch. Zhongwei, could you check
whether it works for you?

Best regards, Michael.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-06  7:50     ` Michael Albinus
@ 2017-09-06 15:13       ` Zhongwei Yao
  2017-09-07 10:23         ` Michael Albinus
  0 siblings, 1 reply; 10+ messages in thread
From: Zhongwei Yao @ 2017-09-06 15:13 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Hi, Michael,
Thanks for your suggestion. But it doesn't resolve all issues.

After applied your mentioned patch, the "File /scp:xxx@my-rasp-pi:/home/xxx/
project/test_gdb/"/home/xxx/project/test_gdb/test.c" no longer exists!"
error is gone. And I can see the red dot breakpoint at the fringe of the
source buffer after setting a breakpoint (on line 7 of test.c). So far is
OK.

But when I run and stop at the breakpoint line 7 and then step into line 7,
the cursor of source buffer will not move at all. And then emacs become
irresponsive after running several step commands. I press Ctrl-G several
times. Then it returns error: json-read-string: Bad string format: "doesn't
start with `\"'!"

Here is the backtrace for above error:

Debugger entered--Lisp error: (json-string-format "doesn't start with
`\"'!")
  signal(json-string-format ("doesn't start with `\"'!"))
  json-read-string()
  json-read-object()
  apply(json-read-object nil)
  json-read()
  gdb-json-read-buffer(nil nil)
  gdb-json-partial-output()
  gdb-thread-list-handler-custom()
  gdb-thread-list-handler()
  apply(gdb-thread-list-handler nil)
  (save-current-buffer (set-buffer #<buffer *threads of test*>) (apply
(quote gdb-thread-list-handler) args))
  (with-current-buffer #<buffer *threads of test*> (apply (quote
gdb-thread-list-handler) args))
  (lambda (&rest args) (with-current-buffer #<buffer *threads of test*>
(apply (quote gdb-thread-list-handler) args)))()
  gdb-handle-reply(27)
  gdb-done-or-error("27" done "threads=[{id=\"1\",target-id=\"process
25128\",name=\"test\",frame={level=\"0\",addr=\"0x00000000004004f4\",func=\"main\",args=[],file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\"},state=\"stopped\",core=\"24\"}],current-thread-id=\"1\""
t)
  gdb-done("27" "threads=[{id=\"1\",target-id=\"process
25128\",name=\"test\",frame={level=\"0\",addr=\"0x00000000004004f4\",func=\"main\",args=[],file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\"},state=\"stopped\",core=\"24\"}],current-thread-id=\"1\""
t)
  gdbmi-bnf-incomplete-record-result("27" (gdb-done . progressive))
  #[0 "\302\300\301\242\"\207" ["27" ((gdb-done . progressive))
gdbmi-bnf-incomplete-record-result] 3]()
  gdbmi-bnf-result-and-async-record-impl()
  gdbmi-bnf-async-record()
  gdbmi-bnf-out-of-band-record()
  gdbmi-bnf-output()
  gud-gdbmi-marker-filter("27^done,threads=[{id=\"1\",target-id=\"process
25128\",name=\"test\",frame={level=\"0\",addr=\"0x00000000004004f4\",func=\"main\",args=[],file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\"},state=\"stopped\",core=\"24\"}],current-thread-id=\"1\"\n(gdb)
\n28^done,BreakpointTable={nr_rows=\"1\",nr_cols=\"6\",hdr=[{width=\"7\",alignment=\"-1\",col_name=\"number\",colhdr=\"Num\"},{width=\"14\",alignment=\"-1\",col_name=\"type\",colhdr=\"Type\"},{width=\"4\",alignment=\"-1\",col_name=\"disp\",colhdr=\"Disp\"},{width=\"3\",alignment=\"-1\",col_name=\"enabled\",colhdr=\"Enb\"},{width=\"18\",alignment=\"-1\",col_name=\"addr\",colhdr=\"Address\"},{width=\"40\",alignment=\"2\",col_name=\"what\",colhdr=\"What\"}],body=[bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000000004004f4\",func=\"main\",file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\",thread-groups=[\"i1\"],times=\"1\",original-location=\"/home/xxx/projects/tests/test_gdb/test.c:7\"}]}\n(gdb)
\n29^done,locals=[]\n(gdb) \n30^done,stack=[frame={level=\"0\",addr=\"")
  apply(gud-gdbmi-marker-filter
"27^done,threads=[{id=\"1\",target-id=\"process
25128\",name=\"test\",frame={level=\"0\",addr=\"0x00000000004004f4\",func=\"main\",args=[],file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\"},state=\"stopped\",core=\"24\"}],current-thread-id=\"1\"\n(gdb)
\n28^done,BreakpointTable={nr_rows=\"1\",nr_cols=\"6\",hdr=[{width=\"7\",alignment=\"-1\",col_name=\"number\",colhdr=\"Num\"},{width=\"14\",alignment=\"-1\",col_name=\"type\",colhdr=\"Type\"},{width=\"4\",alignment=\"-1\",col_name=\"disp\",colhdr=\"Disp\"},{width=\"3\",alignment=\"-1\",col_name=\"enabled\",colhdr=\"Enb\"},{width=\"18\",alignment=\"-1\",col_name=\"addr\",colhdr=\"Address\"},{width=\"40\",alignment=\"2\",col_name=\"what\",colhdr=\"What\"}],body=[bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000000004004f4\",func=\"main\",file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\",thread-groups=[\"i1\"],times=\"1\",original-location=\"/home/xxx/projects/tests/test_gdb/test.c:7\"}]}\n(gdb)
\n29^done,locals=[]\n(gdb) \n30^done,stack=[frame={level=\"0\",addr=\"")
  gud-marker-filter("27^done,threads=[{id=\"1\",target-id=\"process
25128\",name=\"test\",frame={level=\"0\",addr=\"0x00000000004004f4\",func=\"main\",args=[],file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\"},state=\"stopped\",core=\"24\"}],current-thread-id=\"1\"\n(gdb)
\n28^done,BreakpointTable={nr_rows=\"1\",nr_cols=\"6\",hdr=[{width=\"7\",alignment=\"-1\",col_name=\"number\",colhdr=\"Num\"},{width=\"14\",alignment=\"-1\",col_name=\"type\",colhdr=\"Type\"},{width=\"4\",alignment=\"-1\",col_name=\"disp\",colhdr=\"Disp\"},{width=\"3\",alignment=\"-1\",col_name=\"enabled\",colhdr=\"Enb\"},{width=\"18\",alignment=\"-1\",col_name=\"addr\",colhdr=\"Address\"},{width=\"40\",alignment=\"2\",col_name=\"what\",colhdr=\"What\"}],body=[bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000000004004f4\",func=\"main\",file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\",thread-groups=[\"i1\"],times=\"1\",original-location=\"/home/xxx/projects/tests/test_gdb/test.c:7\"}]}\n(gdb)
\n29^done,locals=[]\n(gdb) \n30^done,stack=[frame={level=\"0\",addr=\"")
  gud-filter(#<process gud-test>
"27^done,threads=[{id=\"1\",target-id=\"process
25128\",name=\"test\",frame={level=\"0\",addr=\"0x00000000004004f4\",func=\"main\",args=[],file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\"},state=\"stopped\",core=\"24\"}],current-thread-id=\"1\"\n(gdb)
\n28^done,BreakpointTable={nr_rows=\"1\",nr_cols=\"6\",hdr=[{width=\"7\",alignment=\"-1\",col_name=\"number\",colhdr=\"Num\"},{width=\"14\",alignment=\"-1\",col_name=\"type\",colhdr=\"Type\"},{width=\"4\",alignment=\"-1\",col_name=\"disp\",colhdr=\"Disp\"},{width=\"3\",alignment=\"-1\",col_name=\"enabled\",colhdr=\"Enb\"},{width=\"18\",alignment=\"-1\",col_name=\"addr\",colhdr=\"Address\"},{width=\"40\",alignment=\"2\",col_name=\"what\",colhdr=\"What\"}],body=[bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00000000004004f4\",func=\"main\",file=\"test.c\",fullname=\"/home/xxx/projects/tests/test_gdb/test.c\",line=\"7\",thread-groups=[\"i1\"],times=\"1\",original-location=\"/home/xxx/projects/tests/test_gdb/test.c:7\"}]}\n(gdb)
\n29^done,locals=[]\n(gdb) \n30^done,stack=[frame={level=\"0\",addr=\"")


On Wed, Sep 6, 2017 at 3:50 PM, Michael Albinus <michael.albinus@gmx.de>
wrote:

> Glenn Morris <rgm@gnu.org> writes:
>
> >> This looks to me like the Emacs bug <https://debbugs.gnu.org/23608>. It
> >> is reported as solved in Emacs 25.2.
> >
> > I believe that was before 25.2 was released, and before renumbering
> > occurred. It is actually marked as fixed in 26.1, ie not yet fixed in
> > any release.
>
> Indeed.
>
> The bug report contains the applied patch. Zhongwei, could you check
> whether it works for you?
>
> Best regards, Michael.
>

Thanks,
Zhongwei


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-06 15:13       ` Zhongwei Yao
@ 2017-09-07 10:23         ` Michael Albinus
  2017-09-07 12:30           ` Zhongwei Yao
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2017-09-07 10:23 UTC (permalink / raw)
  To: Zhongwei Yao; +Cc: help-gnu-emacs

Zhongwei Yao <ashi08104@gmail.com> writes:

> Hi, Michael,

Hi Zhongwei,

> But when I run and stop at the breakpoint line 7 and then step into
> line 7, the cursor of source buffer will not move at all. And then
> emacs become irresponsive after running several step commands. I press
> Ctrl-G several times. Then it returns error: json-read-string: Bad
> string format: "doesn't start with `\"'!"

I could reproduce it partly. For me, the cursor of the source buffer
also didn't move. But Emacs didn't block; I could debug until the end.

Unfortunately, I'm not a gdb expert, so I cannot help much. I recommend
you write a bug report towards Emacs, using "M-x report-emacs-bug".

> Thanks,
> Zhongwei

Best regards, Michael.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to make gdb debug mode work with tramp?
  2017-09-07 10:23         ` Michael Albinus
@ 2017-09-07 12:30           ` Zhongwei Yao
  0 siblings, 0 replies; 10+ messages in thread
From: Zhongwei Yao @ 2017-09-07 12:30 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Ok, I'll do that.

2017年9月7日 下午6:23,"Michael Albinus" <michael.albinus@gmx.de>写道:

Zhongwei Yao <ashi08104@gmail.com> writes:

> Hi, Michael,

Hi Zhongwei,

> But when I run and stop at the breakpoint line 7 and then step into
> line 7, the cursor of source buffer will not move at all. And then
> emacs become irresponsive after running several step commands. I press
> Ctrl-G several times. Then it returns error: json-read-string: Bad
> string format: "doesn't start with `\"'!"

I could reproduce it partly. For me, the cursor of the source buffer
also didn't move. But Emacs didn't block; I could debug until the end.

Unfortunately, I'm not a gdb expert, so I cannot help much. I recommend
you write a bug report towards Emacs, using "M-x report-emacs-bug".

> Thanks,
> Zhongwei

Best regards, Michael.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-09-07 12:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-03 14:10 How to make gdb debug mode work with tramp? Zhongwei Yao
2017-09-05  6:39 ` Zhongwei Yao
2017-09-05 14:36 ` Michael Albinus
2017-09-05 15:43   ` Glenn Morris
2017-09-05 19:31     ` Mario Castelán Castro
2017-09-05 22:13       ` Glenn Morris
2017-09-06  7:50     ` Michael Albinus
2017-09-06 15:13       ` Zhongwei Yao
2017-09-07 10:23         ` Michael Albinus
2017-09-07 12:30           ` Zhongwei Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).