Skip to contentSkip to conversation

hmp: fix info cpus for sparc targets

PATCH Applied Aurelien Jarno 2 participants 2 messages Oct 19, 2012 – Oct 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hmp: fix info cpus for sparc targets

On sparc targets, info cpus returns this kind of output:

| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460

pc is printed twice, there is no space between pc, pc and npc.

With this patch, pc is not printed anymore when has_npc is set. In addition the space is printed before pc/nip/npc/PC instead of after the colon so that multiple prints are possible. This result on the following kind of input on sparc targets:

| info cpus
| * CPU #0: pc=0x0000000000424d18 npc=0x0000000000424d1c thread_id=19460

Cc Luiz Capitulino <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Blue Swirl <[email protected]>
---
 hmp.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Changes v1 -> v2: strategy change, has_npc doesn't imply has_pc anymore.

hmp.c +5 -6
index 70bdec2..296adc3 100644
@@ -233,20 +233,19 @@ void hmp_info_cpus(Monitor *mon)
             active = '*';
         }
 
-        monitor_printf(mon, "%c CPU #%" PRId64 ": ", active, cpu->value->CPU);
+        monitor_printf(mon, "%c CPU #%" PRId64 ":", active, cpu->value->CPU);
 
         if (cpu->value->has_pc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+            monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->pc);
         }
         if (cpu->value->has_nip) {
-            monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
+            monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->nip);
         }
         if (cpu->value->has_npc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
-            monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
+            monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->npc);
         }
         if (cpu->value->has_PC) {
-            monitor_printf(mon, "PC=0x%016" PRIx64, cpu->value->PC);
+            monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->PC);
         }
 
         if (cpu->value->halted) {
Signature · 1 line
1.7.10.4
Acked-by on v2 1/1 Applied
#1 lore raw
Quoted 12 lines · On Fri, 19 Oct 2012 23:19:19 +0200 Aurelien Jarno <[email protected]> wrote:

On sparc targets, info cpus returns this kind of output:

| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460

pc is printed twice, there is no space between pc, pc and npc.

With this patch, pc is not printed anymore when has_npc is set. In addition the space is printed before pc/nip/npc/PC instead of after the colon so that multiple prints are possible. This result on the following kind of input on sparc targets:

Quoted 7 lines

| info cpus
| * CPU #0: pc=0x0000000000424d18 npc=0x0000000000424d1c thread_id=19460

Cc Luiz Capitulino <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Blue Swirl <[email protected]>

I've applied this one to the qmp branch. If you want to merge it yourself feel free to add:

Quoted 36 lines
---
 hmp.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Changes v1 -> v2: strategy change, has_npc doesn't imply has_pc anymore.

hmp.c +5 -6
index 70bdec2..296adc3 100644
@@ -233,20 +233,19 @@ void hmp_info_cpus(Monitor *mon)
             active = '*';
         }
 
-        monitor_printf(mon, "%c CPU #%" PRId64 ": ", active, cpu->value->CPU);
+        monitor_printf(mon, "%c CPU #%" PRId64 ":", active, cpu->value->CPU);
 
         if (cpu->value->has_pc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+            monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->pc);
         }
         if (cpu->value->has_nip) {
-            monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
+            monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->nip);
         }
         if (cpu->value->has_npc) {
-            monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
-            monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
+            monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->npc);
         }
         if (cpu->value->has_PC) {
-            monitor_printf(mon, "PC=0x%016" PRIx64, cpu->value->PC);
+            monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->PC);
         }
 
         if (cpu->value->halted) {