fix '-cpu ?' Segfault
PATCH 1/1 fix '-cpu ?' Segfault
Fix stupid copy&paste mistake at commit ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on the cpu_list() call.
--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
@@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp)cpudef_init ();if (cpu_model && *cpu_model =='?' ) { -list_cpus (stdout, &fprintf, optarg); +list_cpus (stdout, &fprintf, cpu_model);exit (0 ); }
Signature · 1 line
1.7.3.2
Stefan Hajnoczi
AppliedQuoted 9 lines · Eduardo Habkost
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on thecpu_list()call.Reported-by Jiri Denemark <[email protected]>Signed-off-by Eduardo Habkost <[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches
Stefan
Quoted 15 lines · Eduardo Habkost
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on thecpu_list()call.Reported-by Jiri Denemark<[email protected]>Signed-off-by Eduardo Habkost<[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)vl.c +0
-0
vl.c int main(int argc, char **argv, char **envp) · line 3202
Quoted 8 lines
vl.c +1
-1@@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp)cpudef_init ();if (cpu_model&& *cpu_model =='?' ) { -list_cpus (stdout,&fprintf, optarg); +list_cpus (stdout,&fprintf, cpu_model);exit (0 ); }
Does -cpu ? actually work then? I only see the list of cpus when using -cpu ?_ for example.
Stefan
Am 22.03.2012 14:28, schrieb Stefan Berger:
Quoted 18 lines · Eduardo Habkost
Quoted 17 lines
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on thecpu_list()call.Reported-by Jiri Denemark<[email protected]>Signed-off-by Eduardo Habkost<[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)vl.c +0
-0@@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp)cpudef_init ();
Quoted 8 lines
vl.c int main(int argc, char **argv, char **envp) · line 3202
Quoted 6 lines
vl.c +1
-1if (cpu_model&& *cpu_model =='?' ) { -list_cpus (stdout,&fprintf, optarg); +list_cpus (stdout,&fprintf, cpu_model);exit (0 ); }Does -cpu ? actually work then? I only see the list of cpus when using -cpu ?_ for example.
You're right, it should be cpu_model + 1 from what I recall, i.e. just the optional argument, not the whole model string.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 28 lines · Andreas Färber
Am 22.03.2012 14:28, schrieb Stefan Berger:
Quoted 18 lines · Eduardo Habkost
Quoted 17 lines
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on thecpu_list()call.Reported-by Jiri Denemark<[email protected]>Signed-off-by Eduardo Habkost<[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)vl.c +0
-0@@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp)cpudef_init ();Quoted 8 lines
vl.c int main(int argc, char **argv, char **envp) · line 3202
Quoted 6 lines
vl.c +1
-1if (cpu_model&& *cpu_model =='?' ) { -list_cpus (stdout,&fprintf, optarg); +list_cpus (stdout,&fprintf, cpu_model);exit (0 ); }Does -cpu ? actually work then? I only see the list of cpus when using -cpu ?_ for example.
Quoted 2 lines
You're right, it should be
cpu_model+ 1 from what I recall, i.e. just the optional argument, not the whole model string.
No, list_cpus() expects the whole argument string, including the leading "?":
void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
{
/* XXX: implement xxx_cpu_list for targets that still miss it */
#if defined(cpu_list_id)
cpu_list_id(f, cpu_fprintf, optarg);#elif defined(cpu_list)
cpu_list(f, cpu_fprintf); /* deprecated */
#endif
}
[...]
#define cpu_list_id x86_cpu_list
[...]
void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
{
unsigned char model = !strcmp("?model", optarg);
unsigned char dump = !strcmp("?dump", optarg);
unsigned char cpuid = !strcmp("?cpuid", optarg);[...]
Signature · 1 line
Eduardo
Quoted 18 lines · Stefan Berger
Quoted 17 lines · Eduardo Habkost
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on thecpu_list()call.Reported-by Jiri Denemark<[email protected]>Signed-off-by Eduardo Habkost<[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)vl.c +0
-0@@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp)cpudef_init ();
Quoted 8 lines
vl.c int main(int argc, char **argv, char **envp) · line 3202
Quoted 6 lines
vl.c +1
-1if (cpu_model&& *cpu_model =='?' ) { -list_cpus (stdout,&fprintf, optarg); +list_cpus (stdout,&fprintf, cpu_model);exit (0 ); }Does -cpu ? actually work then? I only see the list of cpus when using -cpu ?_ for example.
I think this is actually just a shell issue:
mdroth@illuin:~/tmp/empty$ ls mdroth@illuin:~/tmp/empty$ echo ? ? mdroth@illuin:~/tmp/empty$ touch a mdroth@illuin:~/tmp/empty$ echo ? a mdroth@illuin:~/tmp/empty$ echo ?_ ?_
Quoted 4 lines
Stefan
Quoted 19 lines · Michael Roth
Quoted 18 lines · Stefan Berger
Quoted 17 lines · Eduardo Habkost
Fix stupid copy&paste mistake at commit
ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but kept "optarg" on thecpu_list()call.Reported-by Jiri Denemark<[email protected]>Signed-off-by Eduardo Habkost<[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)vl.c +0
-0@@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp)cpudef_init ();
Quoted 8 lines
Quoted 8 lines
vl.c int main(int argc, char **argv, char **envp) · line 3202
Quoted 6 lines
vl.c +1
-1if (cpu_model&& *cpu_model =='?' ) { -list_cpus (stdout,&fprintf, optarg); +list_cpus (stdout,&fprintf, cpu_model);exit (0 ); }Does -cpu ? actually work then? I only see the list of cpus when using -cpu ?_ for example.
use "-cpu \?"
Quoted 17 lines
I think this is actually just a shell issue:
mdroth@illuin:~/tmp/empty$ ls mdroth@illuin:~/tmp/empty$ echo ? ? mdroth@illuin:~/tmp/empty$ touch a mdroth@illuin:~/tmp/empty$ echo ? a mdroth@illuin:~/tmp/empty$ echo ?_ ?_Quoted 4 lines
Stefan