All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH qemu 1/1] docs: how to use gdb with unix sockets
  2021-08-10 16:49 [PATCH qemu 0/1] Document how to use gdbserver with unix sockets ~archi42
@ 2021-08-10 16:04 ` ~archi42
  2021-08-10 19:25   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: ~archi42 @ 2021-08-10 16:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

From: Sebastian Meyer <meyer@absint.com>

Signed-off-by: Sebastian Meyer <meyer@absint.com>
---
 docs/system/gdb.rst | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst
index 144d083df3..2ff4d6aab5 100644
--- a/docs/system/gdb.rst
+++ b/docs/system/gdb.rst
@@ -15,7 +15,8 @@ The ``-s`` option will make QEMU listen for an incoming connection
 from gdb on TCP port 1234, and ``-S`` will make QEMU not start the
 guest until you tell it to from gdb. (If you want to specify which
 TCP port to use or to use something other than TCP for the gdbstub
-connection, use the ``-gdb dev`` option instead of ``-s``.)
+connection, use the ``-gdb dev`` option instead of ``-s``. See
+further below for an example using unix sockets.)
 
 .. parsed-literal::
 
@@ -168,3 +169,24 @@ The memory mode can be checked by sending the following command:
 
 ``maintenance packet Qqemu.PhyMemMode:0``
     This will change it back to normal memory mode.
+
+Using unix sockets
+^^^^^^^^^^^^^^^^^^
+
+An alternate method for connecting gdb to the qemu gdbstub are unix
+sockets (if supported by your operating system). This is useful when
+running serveral tests in parallel and/or you do not know a free tcp
+port a priori (e.g. when running automated tests).
+First create a new chardev with the appropriate options, then
+instruct the gdbserver to use that device::
+
+.. parsed-literal::
+
+   |qemu_system| -chardev socket,path=/tmp/gdb-socket,server=on,wait=off,id=gdb0 -gdb chardev:gdb0 -S -kernel bzImage -hda rootdisk.img -append "root=/dev/hda"
+
+Start gdb as before, but this time connect using the path to
+the socket::
+
+   (gdb) target remote /tmp/gdb-socket
+
+Please mind that this usually requires gdb version 9.0 or newer.
-- 
2.32.0


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

* [PATCH qemu 0/1] Document how to use gdbserver with unix sockets
@ 2021-08-10 16:49 ~archi42
  2021-08-10 16:04 ` [PATCH qemu 1/1] docs: how to use gdb " ~archi42
  0 siblings, 1 reply; 3+ messages in thread
From: ~archi42 @ 2021-08-10 16:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

I had some trouble with gdb over unix sockets, and Peter was so nice to
help me out with it on IRC.
This adds some docs for that, so others
might have less trouble:

< pm215> yeah, that would be good

Feel
free to adjust/rephrase/rearrange the patch :)

Sebastian Meyer (1):
  docs: how to use gdb with unix sockets

 docs/system/gdb.rst | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

-- 
2.32.0


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

* Re: [PATCH qemu 1/1] docs: how to use gdb with unix sockets
  2021-08-10 16:04 ` [PATCH qemu 1/1] docs: how to use gdb " ~archi42
@ 2021-08-10 19:25   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-10 19:25 UTC (permalink / raw)
  To: ~archi42, qemu-devel; +Cc: Sebastian Meyer, peter.maydell, Alex Bennée

Yay! Posting from sr.ht works \o/

On 8/10/21 6:04 PM, ~archi42 wrote:
> From: Sebastian Meyer <meyer@absint.com>
> 
> Signed-off-by: Sebastian Meyer <meyer@absint.com>
> ---
>  docs/system/gdb.rst | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst
> index 144d083df3..2ff4d6aab5 100644
> --- a/docs/system/gdb.rst
> +++ b/docs/system/gdb.rst
> @@ -15,7 +15,8 @@ The ``-s`` option will make QEMU listen for an incoming connection
>  from gdb on TCP port 1234, and ``-S`` will make QEMU not start the
>  guest until you tell it to from gdb. (If you want to specify which
>  TCP port to use or to use something other than TCP for the gdbstub
> -connection, use the ``-gdb dev`` option instead of ``-s``.)
> +connection, use the ``-gdb dev`` option instead of ``-s``. See
> +further below for an example using unix sockets.)

Could we insert a link to the 'Using unix sockets' chapter?

>  
>  .. parsed-literal::
>  
> @@ -168,3 +169,24 @@ The memory mode can be checked by sending the following command:
>  
>  ``maintenance packet Qqemu.PhyMemMode:0``
>      This will change it back to normal memory mode.
> +
> +Using unix sockets
> +^^^^^^^^^^^^^^^^^^
> +
> +An alternate method for connecting gdb to the qemu gdbstub are unix

"QEMU"

> +sockets (if supported by your operating system). This is useful when
> +running serveral tests in parallel and/or you do not know a free tcp

"several", "know" -> "have", "TCP"

> +port a priori (e.g. when running automated tests).
> +First create a new chardev with the appropriate options, then

Drop "new"?

> +instruct the gdbserver to use that device::
> +
> +.. parsed-literal::
> +
> +   |qemu_system| -chardev socket,path=/tmp/gdb-socket,server=on,wait=off,id=gdb0 -gdb chardev:gdb0 -S -kernel bzImage -hda rootdisk.img -append "root=/dev/hda"

Maybe simply "-chardev
socket,path=/tmp/gdb-socket,server=on,wait=off,id=gdb0 -gdb chardev:gdb0
..."?

> +
> +Start gdb as before, but this time connect using the path to
> +the socket::
> +
> +   (gdb) target remote /tmp/gdb-socket
> +
> +Please mind that this usually requires gdb version 9.0 or newer.

"Note gdb version 9.0 or newer is required."?


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

end of thread, other threads:[~2021-08-10 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 16:49 [PATCH qemu 0/1] Document how to use gdbserver with unix sockets ~archi42
2021-08-10 16:04 ` [PATCH qemu 1/1] docs: how to use gdb " ~archi42
2021-08-10 19:25   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.