qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode"
  2013-03-05 16:03 [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Fabien Chouteau
@ 2013-03-05 16:03 ` Fabien Chouteau
  2013-03-05 16:07   ` Jan Kiszka
  0 siblings, 1 reply; 9+ messages in thread
From: Fabien Chouteau @ 2013-03-05 16:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: jan.kiszka

This reverts commit 00e94dbc7fd0110b0555d59592b004333adfb4b8.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 gdbstub.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index c0686a9..22078df 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2181,11 +2181,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             goto unknown_command;
         }
     case 'k':
-#ifdef CONFIG_USER_ONLY
         /* Kill the target */
         fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
         exit(0);
-#endif
     case 'D':
         /* Detach packet */
         gdb_breakpoint_remove_all();
-- 
1.7.9.5

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

* Re: [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode"
  2013-03-05 16:03 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Fabien Chouteau
@ 2013-03-05 16:07   ` Jan Kiszka
  2013-03-05 16:30     ` Fabien Chouteau
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2013-03-05 16:07 UTC (permalink / raw)
  To: Fabien Chouteau; +Cc: qemu-devel@nongnu.org

On 2013-03-05 17:03, Fabien Chouteau wrote:
> This reverts commit 00e94dbc7fd0110b0555d59592b004333adfb4b8.

Should also tell us why (by pointing to the other commit e.g.).

Will give this a try ASAP!

Thanks,
Jan

> 
> Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
> ---
>  gdbstub.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index c0686a9..22078df 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2181,11 +2181,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
>              goto unknown_command;
>          }
>      case 'k':
> -#ifdef CONFIG_USER_ONLY
>          /* Kill the target */
>          fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
>          exit(0);
> -#endif
>      case 'D':
>          /* Detach packet */
>          gdb_breakpoint_remove_all();
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

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

* Re: [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode"
  2013-03-05 16:07   ` Jan Kiszka
@ 2013-03-05 16:30     ` Fabien Chouteau
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Chouteau @ 2013-03-05 16:30 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel@nongnu.org

On 03/05/2013 05:07 PM, Jan Kiszka wrote:
> On 2013-03-05 17:03, Fabien Chouteau wrote:
>> This reverts commit 00e94dbc7fd0110b0555d59592b004333adfb4b8.
> 
> Should also tell us why (by pointing to the other commit e.g.).
> 

Yea, I should have put them together.

> Will give this a try ASAP!
> 

Thanks,


-- 
Fabien Chouteau

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

* [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode"
  2013-03-12 14:31 [Qemu-devel] [PATCH 0/2] " Fabien Chouteau
@ 2013-03-12 14:31 ` Fabien Chouteau
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Chouteau @ 2013-03-12 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: jan.kiszka

The requirements described in this patch are implemented by "Add GDB
qAttached support".

This reverts commit 00e94dbc7fd0110b0555d59592b004333adfb4b8.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 gdbstub.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index de95849..ee57124 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2185,11 +2185,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             goto unknown_command;
         }
     case 'k':
-#ifdef CONFIG_USER_ONLY
         /* Kill the target */
         fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
         exit(0);
-#endif
     case 'D':
         /* Detach packet */
         gdb_breakpoint_remove_all();
-- 
1.7.9.5

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

* [Qemu-devel] [PATCH 1/2] Add GDB qAttached support
@ 2015-01-31  9:28 Jan Kiszka
  2015-01-31  9:29 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Jan Kiszka
  2015-02-04 13:36 ` [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Pedro Alves
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Kiszka @ 2015-01-31  9:28 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel, Fabien Chouteau

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

From: Jan Kiszka <jan.kiszka@siemens.com>

With this patch QEMU handles qAttached request from gdb. When QEMU
replies 1, GDB sends a "detach" command at the end of a debugging
session otherwise GDB sends "kill".

The default value for qAttached is 1 on system emulation and 0 on user
emulation.

Based on original version by Fabien Chouteau.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Long pending in my queue. Hope we can finally get these two in via
trivial (that's what they are).

 gdbstub.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index e4a1a79..da3e7cb 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -41,6 +41,12 @@
 #include "qemu/sockets.h"
 #include "sysemu/kvm.h"
 
+#ifdef CONFIG_USER_ONLY
+#define GDB_ATTACHED "0"
+#else
+#define GDB_ATTACHED "1"
+#endif
+
 static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
                                          uint8_t *buf, int len, bool is_write)
 {
@@ -1187,6 +1193,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             put_packet_binary(s, buf, len + 1);
             break;
         }
+        if (strncmp(p, "Attached", 8) == 0) {
+            put_packet(s, GDB_ATTACHED);
+            break;
+        }
         /* Unrecognised 'q' command.  */
         goto unknown_command;
 
-- 
2.1.4


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

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

* [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode"
  2015-01-31  9:28 [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Jan Kiszka
@ 2015-01-31  9:29 ` Jan Kiszka
  2015-02-04 13:36 ` [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Pedro Alves
  1 sibling, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2015-01-31  9:29 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel, Fabien Chouteau

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

From: Fabien Chouteau <chouteau@adacore.com>

The requirements described in this patch are implemented by "Add GDB
qAttached support".

This reverts commit 00e94dbc7fd0110b0555d59592b004333adfb4b8.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 gdbstub.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index da3e7cb..14e1f0c 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -880,11 +880,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             goto unknown_command;
         }
     case 'k':
-#ifdef CONFIG_USER_ONLY
         /* Kill the target */
         fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
         exit(0);
-#endif
     case 'D':
         /* Detach packet */
         gdb_breakpoint_remove_all();
-- 
2.1.4


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

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

* Re: [Qemu-devel] [PATCH 1/2] Add GDB qAttached support
  2015-01-31  9:28 [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Jan Kiszka
  2015-01-31  9:29 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Jan Kiszka
@ 2015-02-04 13:36 ` Pedro Alves
  2015-02-04 14:06   ` Jan Kiszka
  2015-02-04 14:30   ` Peter Maydell
  1 sibling, 2 replies; 9+ messages in thread
From: Pedro Alves @ 2015-02-04 13:36 UTC (permalink / raw)
  To: Jan Kiszka, qemu-trivial; +Cc: qemu-devel, Fabien Chouteau

Hi, I was skimming the list, and noticed:

On 01/31/2015 10:28 AM, Jan Kiszka wrote:
> @@ -1187,6 +1193,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
>              put_packet_binary(s, buf, len + 1);
>              break;
>          }
> +        if (strncmp(p, "Attached", 8) == 0) {

This looks like it'd mishandle a future qAttached2 packet.

It should be doing something like:

       if (strncmp(p, "Attached", 8) == 0 &&
          (p[8] == '\0' || p[8] == ':')) {

or:

       if (strcmp(p, "Attached") == 0 || strncmp(p, "Attached:", 9) == 0) {


Likewise other packets, if they have the same issue.
(I'm not familiar with qemu's stub's internals.)

Thanks,
Pedro Alves

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

* Re: [Qemu-devel] [PATCH 1/2] Add GDB qAttached support
  2015-02-04 13:36 ` [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Pedro Alves
@ 2015-02-04 14:06   ` Jan Kiszka
  2015-02-04 14:30   ` Peter Maydell
  1 sibling, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2015-02-04 14:06 UTC (permalink / raw)
  To: Pedro Alves, qemu-trivial; +Cc: qemu-devel, Fabien Chouteau

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

On 2015-02-04 14:36, Pedro Alves wrote:
> Hi, I was skimming the list, and noticed:
> 
> On 01/31/2015 10:28 AM, Jan Kiszka wrote:
>> @@ -1187,6 +1193,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
>>              put_packet_binary(s, buf, len + 1);
>>              break;
>>          }
>> +        if (strncmp(p, "Attached", 8) == 0) {
> 
> This looks like it'd mishandle a future qAttached2 packet.
> 
> It should be doing something like:
> 
>        if (strncmp(p, "Attached", 8) == 0 &&
>           (p[8] == '\0' || p[8] == ':')) {
> 
> or:
> 
>        if (strcmp(p, "Attached") == 0 || strncmp(p, "Attached:", 9) == 0) {
> 
> 
> Likewise other packets, if they have the same issue.
> (I'm not familiar with qemu's stub's internals.)

Thanks for the remark! Will update the patch using the easier readable
second variant.

Jan



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

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

* Re: [Qemu-devel] [PATCH 1/2] Add GDB qAttached support
  2015-02-04 13:36 ` [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Pedro Alves
  2015-02-04 14:06   ` Jan Kiszka
@ 2015-02-04 14:30   ` Peter Maydell
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2015-02-04 14:30 UTC (permalink / raw)
  To: Pedro Alves; +Cc: qemu-trivial, Jan Kiszka, qemu-devel, Fabien Chouteau

On 4 February 2015 at 13:36, Pedro Alves <palves@redhat.com> wrote:
>
> This looks like it'd mishandle a future qAttached2 packet.
>
> It should be doing something like:
>
>        if (strncmp(p, "Attached", 8) == 0 &&
>           (p[8] == '\0' || p[8] == ':')) {
>
> or:
>
>        if (strcmp(p, "Attached") == 0 || strncmp(p, "Attached:", 9) == 0) {
>
>
> Likewise other packets, if they have the same issue.
> (I'm not familiar with qemu's stub's internals.)

Looks like we get this wrong for a lot of our existing
query packet handling too... Maybe worth having a utility
function for "is this a foo query packet" rather than
raw strcmp/strncmp?

-- PMM

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

end of thread, other threads:[~2015-02-04 14:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-31  9:28 [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Jan Kiszka
2015-01-31  9:29 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Jan Kiszka
2015-02-04 13:36 ` [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Pedro Alves
2015-02-04 14:06   ` Jan Kiszka
2015-02-04 14:30   ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2013-03-12 14:31 [Qemu-devel] [PATCH 0/2] " Fabien Chouteau
2013-03-12 14:31 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Fabien Chouteau
2013-03-05 16:03 [Qemu-devel] [PATCH 1/2] Add GDB qAttached support Fabien Chouteau
2013-03-05 16:03 ` [Qemu-devel] [PATCH 2/2] Revert "gdbstub: Do not kill target in system emulation mode" Fabien Chouteau
2013-03-05 16:07   ` Jan Kiszka
2013-03-05 16:30     ` Fabien Chouteau

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 NNTP newsgroup(s).