Error reporting patches for 2018-02-06

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJaegaOAAoJEDhwtADrkYZT5HcP/ApeXZCqiDOiJrpq046gCahC
 0Bl31NPiOloS6ya8gFT3p3ufeRdvKfdPRTWwa8lHOIkWXEvF/OtNQQGJ7Ff4HB0F
 f2o8yMS68srJ6zasCwizwY98vxo0574Hd9coZRGRKBvC9qm8jVDqNs2JxqUF/OhK
 Z+3XJ4uAFtqKDE6zXWqc/e/aRQe/1Z4zFwzl6p7MvpcBI06s81jIa3W0Pqz7BFtS
 jcXjrkV6bcD28cibK5P3A21wNICrD0yGhMHL0ZZ5iPTDZdoUY0CDYiUeynhI3TgL
 iyCNpc/ANA4BLU6CN5eWd4PWswhSlLx0LqV5qDnQYgNP2v1JzWDrHOfCq7jgk1rb
 rY8NMkFinBH7eyidOfPd6FWU3f+Gz+niNdbPTMv1HfkC+GIsndhNEw8TkZTR02RE
 kgGFcfNoBihfpo8VfnS2hCv8ZG8eExna6H9j4qkIOGoCOnqeq4+cyOI3Yya3vNDC
 Snx0Npb1alLAXasyLxMSTJjcCPqzH4co2YJWYzO4bXqTOS3V/SUx+0cVIwHElDRw
 0Pm2Eff7s/nGBvBuBrPjZwjAGpDCeAOTCboUsgTB6SH0iwzuIFeCM7k191WkGhz3
 BFdsdbOgwSrEy8bA8HgNJrjPZ65Zvct8q8L7EuhahYZRvnO5qa2LhN8ID4vaizDa
 gNjc8Z9F8PfWMJ8rGdWA
 =LSkA
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-02-06' into staging

Error reporting patches for 2018-02-06

# gpg: Signature made Tue 06 Feb 2018 19:48:30 GMT
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2018-02-06:
  tcg: Replace fprintf(stderr, "*\n" with error_report()
  hw/xen*: Replace fprintf(stderr, "*\n" with error_report()
  hw/sparc*: Replace fprintf(stderr, "*\n" with error_report()
  hw/sd: Replace fprintf(stderr, "*\n" with DPRINTF()
  hw/ppc: Replace fprintf(stderr, "*\n" with error_report()
  hw/pci*: Replace fprintf(stderr, "*\n" with error_report()
  hw/openrisc: Replace fprintf(stderr, "*\n" with error_report()
  hw/moxie: Replace fprintf(stderr, "*\n" with error_report()
  hw/mips: Replace fprintf(stderr, "*\n" with error_report()
  hw/lm32: Replace fprintf(stderr, "*\n" with error_report()
  hw/dma: Replace fprintf(stderr, "*\n" with error_report()
  hw/arm: Replace fprintf(stderr, "*\n" with error_report()
  audio: Replace AUDIO_FUNC with __func__
  error: Improve documentation of error_append_hint()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-02-07 16:26:01 +00:00
commit 17a5bbb44d
52 changed files with 265 additions and 273 deletions

View File

@ -823,7 +823,7 @@ static int alsa_init_out(HWVoiceOut *hw, struct audsettings *as,
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = obt.samples; hw->samples = obt.samples;
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift); alsa->pcm_buf = audio_calloc(__func__, obt.samples, 1 << hw->info.shift);
if (!alsa->pcm_buf) { if (!alsa->pcm_buf) {
dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n", dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift); hw->samples, 1 << hw->info.shift);
@ -934,7 +934,7 @@ static int alsa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = obt.samples; hw->samples = obt.samples;
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); alsa->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!alsa->pcm_buf) { if (!alsa->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift); hw->samples, 1 << hw->info.shift);

View File

@ -424,12 +424,12 @@ static void audio_process_options (const char *prefix,
const char qemu_prefix[] = "QEMU_"; const char qemu_prefix[] = "QEMU_";
size_t preflen, optlen; size_t preflen, optlen;
if (audio_bug (AUDIO_FUNC, !prefix)) { if (audio_bug(__func__, !prefix)) {
dolog ("prefix = NULL\n"); dolog ("prefix = NULL\n");
return; return;
} }
if (audio_bug (AUDIO_FUNC, !opt)) { if (audio_bug(__func__, !opt)) {
dolog ("opt = NULL\n"); dolog ("opt = NULL\n");
return; return;
} }
@ -792,7 +792,7 @@ static int audio_attach_capture (HWVoiceOut *hw)
SWVoiceOut *sw; SWVoiceOut *sw;
HWVoiceOut *hw_cap = &cap->hw; HWVoiceOut *hw_cap = &cap->hw;
sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); sc = audio_calloc(__func__, 1, sizeof(*sc));
if (!sc) { if (!sc) {
dolog ("Could not allocate soft capture voice (%zu bytes)\n", dolog ("Could not allocate soft capture voice (%zu bytes)\n",
sizeof (*sc)); sizeof (*sc));
@ -848,7 +848,7 @@ static int audio_pcm_hw_find_min_in (HWVoiceIn *hw)
int audio_pcm_hw_get_live_in (HWVoiceIn *hw) int audio_pcm_hw_get_live_in (HWVoiceIn *hw)
{ {
int live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw); int live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw);
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -886,7 +886,7 @@ static int audio_pcm_sw_get_rpos_in (SWVoiceIn *sw)
int live = hw->total_samples_captured - sw->total_hw_samples_acquired; int live = hw->total_samples_captured - sw->total_hw_samples_acquired;
int rpos; int rpos;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -909,7 +909,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples; rpos = audio_pcm_sw_get_rpos_in (sw) % hw->samples;
live = hw->total_samples_captured - sw->total_hw_samples_acquired; live = hw->total_samples_captured - sw->total_hw_samples_acquired;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live_in=%d hw->samples=%d\n", live, hw->samples); dolog ("live_in=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -935,7 +935,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
} }
osamp = swlim; osamp = swlim;
if (audio_bug (AUDIO_FUNC, osamp < 0)) { if (audio_bug(__func__, osamp < 0)) {
dolog ("osamp=%d\n", osamp); dolog ("osamp=%d\n", osamp);
return 0; return 0;
} }
@ -990,7 +990,7 @@ static int audio_pcm_hw_get_live_out (HWVoiceOut *hw, int *nb_live)
if (nb_live1) { if (nb_live1) {
int live = smin; int live = smin;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
return 0; return 0;
} }
@ -1014,7 +1014,7 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)
hwsamples = sw->hw->samples; hwsamples = sw->hw->samples;
live = sw->total_hw_samples_mixed; live = sw->total_hw_samples_mixed;
if (audio_bug (AUDIO_FUNC, live < 0 || live > hwsamples)){ if (audio_bug(__func__, live < 0 || live > hwsamples)) {
dolog ("live=%d hw->samples=%d\n", live, hwsamples); dolog ("live=%d hw->samples=%d\n", live, hwsamples);
return 0; return 0;
} }
@ -1263,7 +1263,7 @@ static int audio_get_avail (SWVoiceIn *sw)
} }
live = sw->hw->total_samples_captured - sw->total_hw_samples_acquired; live = sw->hw->total_samples_captured - sw->total_hw_samples_acquired;
if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { if (audio_bug(__func__, live < 0 || live > sw->hw->samples)) {
dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples);
return 0; return 0;
} }
@ -1287,7 +1287,7 @@ static int audio_get_free (SWVoiceOut *sw)
live = sw->total_hw_samples_mixed; live = sw->total_hw_samples_mixed;
if (audio_bug (AUDIO_FUNC, live < 0 || live > sw->hw->samples)) { if (audio_bug(__func__, live < 0 || live > sw->hw->samples)) {
dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples); dolog ("live=%d sw->hw->samples=%d\n", live, sw->hw->samples);
return 0; return 0;
} }
@ -1354,7 +1354,7 @@ static void audio_run_out (AudioState *s)
live = 0; live = 0;
} }
if (audio_bug (AUDIO_FUNC, live < 0 || live > hw->samples)) { if (audio_bug(__func__, live < 0 || live > hw->samples)) {
dolog ("live=%d hw->samples=%d\n", live, hw->samples); dolog ("live=%d hw->samples=%d\n", live, hw->samples);
continue; continue;
} }
@ -1389,7 +1389,7 @@ static void audio_run_out (AudioState *s)
prev_rpos = hw->rpos; prev_rpos = hw->rpos;
played = hw->pcm_ops->run_out (hw, live); played = hw->pcm_ops->run_out (hw, live);
replay_audio_out(&played); replay_audio_out(&played);
if (audio_bug (AUDIO_FUNC, hw->rpos >= hw->samples)) { if (audio_bug(__func__, hw->rpos >= hw->samples)) {
dolog ("hw->rpos=%d hw->samples=%d played=%d\n", dolog ("hw->rpos=%d hw->samples=%d played=%d\n",
hw->rpos, hw->samples, played); hw->rpos, hw->samples, played);
hw->rpos = 0; hw->rpos = 0;
@ -1410,7 +1410,7 @@ static void audio_run_out (AudioState *s)
continue; continue;
} }
if (audio_bug (AUDIO_FUNC, played > sw->total_hw_samples_mixed)) { if (audio_bug(__func__, played > sw->total_hw_samples_mixed)) {
dolog ("played=%d sw->total_hw_samples_mixed=%d\n", dolog ("played=%d sw->total_hw_samples_mixed=%d\n",
played, sw->total_hw_samples_mixed); played, sw->total_hw_samples_mixed);
played = sw->total_hw_samples_mixed; played = sw->total_hw_samples_mixed;
@ -1513,7 +1513,7 @@ static void audio_run_capture (AudioState *s)
continue; continue;
} }
if (audio_bug (AUDIO_FUNC, captured > sw->total_hw_samples_mixed)) { if (audio_bug(__func__, captured > sw->total_hw_samples_mixed)) {
dolog ("captured=%d sw->total_hw_samples_mixed=%d\n", dolog ("captured=%d sw->total_hw_samples_mixed=%d\n",
captured, sw->total_hw_samples_mixed); captured, sw->total_hw_samples_mixed);
captured = sw->total_hw_samples_mixed; captured = sw->total_hw_samples_mixed;
@ -1924,7 +1924,7 @@ CaptureVoiceOut *AUD_add_capture (
goto err0; goto err0;
} }
cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb)); cb = audio_calloc(__func__, 1, sizeof(*cb));
if (!cb) { if (!cb) {
dolog ("Could not allocate capture callback information, size %zu\n", dolog ("Could not allocate capture callback information, size %zu\n",
sizeof (*cb)); sizeof (*cb));
@ -1942,7 +1942,7 @@ CaptureVoiceOut *AUD_add_capture (
HWVoiceOut *hw; HWVoiceOut *hw;
CaptureVoiceOut *cap; CaptureVoiceOut *cap;
cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap)); cap = audio_calloc(__func__, 1, sizeof(*cap));
if (!cap) { if (!cap) {
dolog ("Could not allocate capture voice, size %zu\n", dolog ("Could not allocate capture voice, size %zu\n",
sizeof (*cap)); sizeof (*cap));
@ -1955,8 +1955,8 @@ CaptureVoiceOut *AUD_add_capture (
/* XXX find a more elegant way */ /* XXX find a more elegant way */
hw->samples = 4096 * 4; hw->samples = 4096 * 4;
hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples, hw->mix_buf = audio_calloc(__func__, hw->samples,
sizeof (struct st_sample)); sizeof(struct st_sample));
if (!hw->mix_buf) { if (!hw->mix_buf) {
dolog ("Could not allocate capture mix buffer (%d samples)\n", dolog ("Could not allocate capture mix buffer (%d samples)\n",
hw->samples); hw->samples);
@ -1965,7 +1965,7 @@ CaptureVoiceOut *AUD_add_capture (
audio_pcm_init_info (&hw->info, as); audio_pcm_init_info (&hw->info, as);
cap->buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); cap->buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!cap->buf) { if (!cap->buf) {
dolog ("Could not allocate capture buffer " dolog ("Could not allocate capture buffer "
"(%d samples, each %d bytes)\n", "(%d samples, each %d bytes)\n",

View File

@ -252,10 +252,4 @@ static inline int audio_ring_dist (int dst, int src, int len)
#define AUDIO_STRINGIFY_(n) #n #define AUDIO_STRINGIFY_(n) #n
#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n) #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
#if defined _MSC_VER || defined __GNUC__
#define AUDIO_FUNC __FUNCTION__
#else
#define AUDIO_FUNC __FILE__ ":" AUDIO_STRINGIFY (__LINE__)
#endif
#endif /* QEMU_AUDIO_INT_H */ #endif /* QEMU_AUDIO_INT_H */

View File

@ -31,7 +31,7 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *),
err = sigfillset (&set); err = sigfillset (&set);
if (err) { if (err) {
logerr (p, errno, "%s(%s): sigfillset failed", cap, AUDIO_FUNC); logerr(p, errno, "%s(%s): sigfillset failed", cap, __func__);
return -1; return -1;
} }
@ -57,8 +57,8 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *),
err2 = pthread_sigmask (SIG_SETMASK, &old_set, NULL); err2 = pthread_sigmask (SIG_SETMASK, &old_set, NULL);
if (err2) { if (err2) {
logerr (p, err2, "%s(%s): pthread_sigmask (restore) failed", logerr(p, err2, "%s(%s): pthread_sigmask (restore) failed",
cap, AUDIO_FUNC); cap, __func__);
/* We have failed to restore original signal mask, all bets are off, /* We have failed to restore original signal mask, all bets are off,
so terminate the process */ so terminate the process */
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@ -74,17 +74,17 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *),
err2: err2:
err2 = pthread_cond_destroy (&p->cond); err2 = pthread_cond_destroy (&p->cond);
if (err2) { if (err2) {
logerr (p, err2, "%s(%s): pthread_cond_destroy failed", cap, AUDIO_FUNC); logerr(p, err2, "%s(%s): pthread_cond_destroy failed", cap, __func__);
} }
err1: err1:
err2 = pthread_mutex_destroy (&p->mutex); err2 = pthread_mutex_destroy (&p->mutex);
if (err2) { if (err2) {
logerr (p, err2, "%s(%s): pthread_mutex_destroy failed", cap, AUDIO_FUNC); logerr(p, err2, "%s(%s): pthread_mutex_destroy failed", cap, __func__);
} }
err0: err0:
logerr (p, err, "%s(%s): %s failed", cap, AUDIO_FUNC, efunc); logerr(p, err, "%s(%s): %s failed", cap, __func__, efunc);
return -1; return -1;
} }
@ -94,13 +94,13 @@ int audio_pt_fini (struct audio_pt *p, const char *cap)
err = pthread_cond_destroy (&p->cond); err = pthread_cond_destroy (&p->cond);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_cond_destroy failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_cond_destroy failed", cap, __func__);
ret = -1; ret = -1;
} }
err = pthread_mutex_destroy (&p->mutex); err = pthread_mutex_destroy (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_destroy failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_destroy failed", cap, __func__);
ret = -1; ret = -1;
} }
return ret; return ret;
@ -112,7 +112,7 @@ int audio_pt_lock (struct audio_pt *p, const char *cap)
err = pthread_mutex_lock (&p->mutex); err = pthread_mutex_lock (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_lock failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_lock failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -124,7 +124,7 @@ int audio_pt_unlock (struct audio_pt *p, const char *cap)
err = pthread_mutex_unlock (&p->mutex); err = pthread_mutex_unlock (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_unlock failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_unlock failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -136,7 +136,7 @@ int audio_pt_wait (struct audio_pt *p, const char *cap)
err = pthread_cond_wait (&p->cond, &p->mutex); err = pthread_cond_wait (&p->cond, &p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_cond_wait failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_cond_wait failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -148,12 +148,12 @@ int audio_pt_unlock_and_signal (struct audio_pt *p, const char *cap)
err = pthread_mutex_unlock (&p->mutex); err = pthread_mutex_unlock (&p->mutex);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_mutex_unlock failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_mutex_unlock failed", cap, __func__);
return -1; return -1;
} }
err = pthread_cond_signal (&p->cond); err = pthread_cond_signal (&p->cond);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_cond_signal failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_cond_signal failed", cap, __func__);
return -1; return -1;
} }
return 0; return 0;
@ -166,7 +166,7 @@ int audio_pt_join (struct audio_pt *p, void **arg, const char *cap)
err = pthread_join (p->thread, &ret); err = pthread_join (p->thread, &ret);
if (err) { if (err) {
logerr (p, err, "%s(%s): pthread_join failed", cap, AUDIO_FUNC); logerr(p, err, "%s(%s): pthread_join failed", cap, __func__);
return -1; return -1;
} }
*arg = ret; *arg = ret;

View File

@ -57,13 +57,13 @@ static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv)
glue (s->nb_hw_voices_, TYPE) = max_voices; glue (s->nb_hw_voices_, TYPE) = max_voices;
} }
if (audio_bug (AUDIO_FUNC, !voice_size && max_voices)) { if (audio_bug(__func__, !voice_size && max_voices)) {
dolog ("drv=`%s' voice_size=0 max_voices=%d\n", dolog ("drv=`%s' voice_size=0 max_voices=%d\n",
drv->name, max_voices); drv->name, max_voices);
glue (s->nb_hw_voices_, TYPE) = 0; glue (s->nb_hw_voices_, TYPE) = 0;
} }
if (audio_bug (AUDIO_FUNC, voice_size && !max_voices)) { if (audio_bug(__func__, voice_size && !max_voices)) {
dolog ("drv=`%s' voice_size=%d max_voices=0\n", dolog ("drv=`%s' voice_size=%d max_voices=0\n",
drv->name, voice_size); drv->name, voice_size);
} }
@ -77,7 +77,7 @@ static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw) static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw)
{ {
HWBUF = audio_calloc (AUDIO_FUNC, hw->samples, sizeof (struct st_sample)); HWBUF = audio_calloc(__func__, hw->samples, sizeof(struct st_sample));
if (!HWBUF) { if (!HWBUF) {
dolog ("Could not allocate " NAME " buffer (%d samples)\n", dolog ("Could not allocate " NAME " buffer (%d samples)\n",
hw->samples); hw->samples);
@ -105,7 +105,7 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw)
samples = ((int64_t) sw->hw->samples << 32) / sw->ratio; samples = ((int64_t) sw->hw->samples << 32) / sw->ratio;
sw->buf = audio_calloc (AUDIO_FUNC, samples, sizeof (struct st_sample)); sw->buf = audio_calloc(__func__, samples, sizeof(struct st_sample));
if (!sw->buf) { if (!sw->buf) {
dolog ("Could not allocate buffer for `%s' (%d samples)\n", dolog ("Could not allocate buffer for `%s' (%d samples)\n",
SW_NAME (sw), samples); SW_NAME (sw), samples);
@ -238,17 +238,17 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
return NULL; return NULL;
} }
if (audio_bug (AUDIO_FUNC, !drv)) { if (audio_bug(__func__, !drv)) {
dolog ("No host audio driver\n"); dolog ("No host audio driver\n");
return NULL; return NULL;
} }
if (audio_bug (AUDIO_FUNC, !drv->pcm_ops)) { if (audio_bug(__func__, !drv->pcm_ops)) {
dolog ("Host audio driver without pcm_ops\n"); dolog ("Host audio driver without pcm_ops\n");
return NULL; return NULL;
} }
hw = audio_calloc (AUDIO_FUNC, 1, glue (drv->voice_size_, TYPE)); hw = audio_calloc(__func__, 1, glue(drv->voice_size_, TYPE));
if (!hw) { if (!hw) {
dolog ("Can not allocate voice `%s' size %d\n", dolog ("Can not allocate voice `%s' size %d\n",
drv->name, glue (drv->voice_size_, TYPE)); drv->name, glue (drv->voice_size_, TYPE));
@ -266,7 +266,7 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
goto err0; goto err0;
} }
if (audio_bug (AUDIO_FUNC, hw->samples <= 0)) { if (audio_bug(__func__, hw->samples <= 0)) {
dolog ("hw->samples=%d\n", hw->samples); dolog ("hw->samples=%d\n", hw->samples);
goto err1; goto err1;
} }
@ -339,7 +339,7 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
hw_as = *as; hw_as = *as;
} }
sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw)); sw = audio_calloc(__func__, 1, sizeof(*sw));
if (!sw) { if (!sw) {
dolog ("Could not allocate soft voice `%s' (%zu bytes)\n", dolog ("Could not allocate soft voice `%s' (%zu bytes)\n",
sw_name ? sw_name : "unknown", sizeof (*sw)); sw_name ? sw_name : "unknown", sizeof (*sw));
@ -379,7 +379,7 @@ static void glue (audio_close_, TYPE) (SW *sw)
void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw)
{ {
if (sw) { if (sw) {
if (audio_bug (AUDIO_FUNC, !card)) { if (audio_bug(__func__, !card)) {
dolog ("card=%p\n", card); dolog ("card=%p\n", card);
return; return;
} }
@ -399,7 +399,7 @@ SW *glue (AUD_open_, TYPE) (
{ {
AudioState *s = &glob_audio_state; AudioState *s = &glob_audio_state;
if (audio_bug (AUDIO_FUNC, !card || !name || !callback_fn || !as)) { if (audio_bug(__func__, !card || !name || !callback_fn || !as)) {
dolog ("card=%p name=%p callback_fn=%p as=%p\n", dolog ("card=%p name=%p callback_fn=%p as=%p\n",
card, name, callback_fn, as); card, name, callback_fn, as);
goto fail; goto fail;
@ -408,12 +408,12 @@ SW *glue (AUD_open_, TYPE) (
ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
name, as->freq, as->nchannels, as->fmt); name, as->freq, as->nchannels, as->fmt);
if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) { if (audio_bug(__func__, audio_validate_settings(as))) {
audio_print_settings (as); audio_print_settings (as);
goto fail; goto fail;
} }
if (audio_bug (AUDIO_FUNC, !s->drv)) { if (audio_bug(__func__, !s->drv)) {
dolog ("Can not open `%s' (no host audio driver)\n", name); dolog ("Can not open `%s' (no host audio driver)\n", name);
goto fail; goto fail;
} }

View File

@ -543,7 +543,7 @@ static int dsound_run_out (HWVoiceOut *hw, int live)
} }
} }
if (audio_bug (AUDIO_FUNC, len < 0 || len > bufsize)) { if (audio_bug(__func__, len < 0 || len > bufsize)) {
dolog ("len=%d bufsize=%d old_pos=%ld ppos=%ld\n", dolog ("len=%d bufsize=%d old_pos=%ld ppos=%ld\n",
len, bufsize, old_pos, ppos); len, bufsize, old_pos, ppos);
return 0; return 0;

View File

@ -344,7 +344,7 @@ struct rate {
*/ */
void *st_rate_start (int inrate, int outrate) void *st_rate_start (int inrate, int outrate)
{ {
struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate)); struct rate *rate = audio_calloc(__func__, 1, sizeof(*rate));
if (!rate) { if (!rate) {
dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate)); dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate));

View File

@ -582,11 +582,9 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as,
} }
if (!oss->mmapped) { if (!oss->mmapped) {
oss->pcm_buf = audio_calloc ( oss->pcm_buf = audio_calloc(__func__,
AUDIO_FUNC,
hw->samples, hw->samples,
1 << hw->info.shift 1 << hw->info.shift);
);
if (!oss->pcm_buf) { if (!oss->pcm_buf) {
dolog ( dolog (
"Could not allocate DAC buffer (%d samples, each %d bytes)\n", "Could not allocate DAC buffer (%d samples, each %d bytes)\n",
@ -705,7 +703,7 @@ static int oss_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
} }
hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift; hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift;
oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); oss->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!oss->pcm_buf) { if (!oss->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift); hw->samples, 1 << hw->info.shift);

View File

@ -206,7 +206,7 @@ static void *qpa_thread_out (void *arg)
PAVoiceOut *pa = arg; PAVoiceOut *pa = arg;
HWVoiceOut *hw = &pa->hw; HWVoiceOut *hw = &pa->hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -222,7 +222,7 @@ static void *qpa_thread_out (void *arg)
break; break;
} }
if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { if (audio_pt_wait(&pa->pt, __func__)) {
goto exit; goto exit;
} }
} }
@ -230,7 +230,7 @@ static void *qpa_thread_out (void *arg)
decr = to_mix = audio_MIN (pa->live, pa->g->conf.samples >> 2); decr = to_mix = audio_MIN (pa->live, pa->g->conf.samples >> 2);
rpos = pa->rpos; rpos = pa->rpos;
if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_unlock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -251,7 +251,7 @@ static void *qpa_thread_out (void *arg)
to_mix -= chunk; to_mix -= chunk;
} }
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -261,7 +261,7 @@ static void *qpa_thread_out (void *arg)
} }
exit: exit:
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
return NULL; return NULL;
} }
@ -270,7 +270,7 @@ static int qpa_run_out (HWVoiceOut *hw, int live)
int decr; int decr;
PAVoiceOut *pa = (PAVoiceOut *) hw; PAVoiceOut *pa = (PAVoiceOut *) hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return 0; return 0;
} }
@ -279,10 +279,10 @@ static int qpa_run_out (HWVoiceOut *hw, int live)
pa->live = live - decr; pa->live = live - decr;
hw->rpos = pa->rpos; hw->rpos = pa->rpos;
if (pa->live > 0) { if (pa->live > 0) {
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
} }
else { else {
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
} }
return decr; return decr;
} }
@ -298,7 +298,7 @@ static void *qpa_thread_in (void *arg)
PAVoiceIn *pa = arg; PAVoiceIn *pa = arg;
HWVoiceIn *hw = &pa->hw; HWVoiceIn *hw = &pa->hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -314,7 +314,7 @@ static void *qpa_thread_in (void *arg)
break; break;
} }
if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { if (audio_pt_wait(&pa->pt, __func__)) {
goto exit; goto exit;
} }
} }
@ -322,7 +322,7 @@ static void *qpa_thread_in (void *arg)
incr = to_grab = audio_MIN (pa->dead, pa->g->conf.samples >> 2); incr = to_grab = audio_MIN (pa->dead, pa->g->conf.samples >> 2);
wpos = pa->wpos; wpos = pa->wpos;
if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_unlock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -342,7 +342,7 @@ static void *qpa_thread_in (void *arg)
to_grab -= chunk; to_grab -= chunk;
} }
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return NULL; return NULL;
} }
@ -352,7 +352,7 @@ static void *qpa_thread_in (void *arg)
} }
exit: exit:
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
return NULL; return NULL;
} }
@ -361,7 +361,7 @@ static int qpa_run_in (HWVoiceIn *hw)
int live, incr, dead; int live, incr, dead;
PAVoiceIn *pa = (PAVoiceIn *) hw; PAVoiceIn *pa = (PAVoiceIn *) hw;
if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { if (audio_pt_lock(&pa->pt, __func__)) {
return 0; return 0;
} }
@ -372,10 +372,10 @@ static int qpa_run_in (HWVoiceIn *hw)
pa->dead = dead - incr; pa->dead = dead - incr;
hw->wpos = pa->wpos; hw->wpos = pa->wpos;
if (pa->dead > 0) { if (pa->dead > 0) {
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
} }
else { else {
audio_pt_unlock (&pa->pt, AUDIO_FUNC); audio_pt_unlock(&pa->pt, __func__);
} }
return incr; return incr;
} }
@ -579,7 +579,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as,
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = g->conf.samples; hw->samples = g->conf.samples;
pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); pa->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
pa->rpos = hw->rpos; pa->rpos = hw->rpos;
if (!pa->pcm_buf) { if (!pa->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n", dolog ("Could not allocate buffer (%d bytes)\n",
@ -587,7 +587,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as,
goto fail2; goto fail2;
} }
if (audio_pt_init (&pa->pt, qpa_thread_out, hw, AUDIO_CAP, AUDIO_FUNC)) { if (audio_pt_init(&pa->pt, qpa_thread_out, hw, AUDIO_CAP, __func__)) {
goto fail3; goto fail3;
} }
@ -636,7 +636,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
audio_pcm_init_info (&hw->info, &obt_as); audio_pcm_init_info (&hw->info, &obt_as);
hw->samples = g->conf.samples; hw->samples = g->conf.samples;
pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); pa->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
pa->wpos = hw->wpos; pa->wpos = hw->wpos;
if (!pa->pcm_buf) { if (!pa->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n", dolog ("Could not allocate buffer (%d bytes)\n",
@ -644,7 +644,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
goto fail2; goto fail2;
} }
if (audio_pt_init (&pa->pt, qpa_thread_in, hw, AUDIO_CAP, AUDIO_FUNC)) { if (audio_pt_init(&pa->pt, qpa_thread_in, hw, AUDIO_CAP, __func__)) {
goto fail3; goto fail3;
} }
@ -667,17 +667,17 @@ static void qpa_fini_out (HWVoiceOut *hw)
void *ret; void *ret;
PAVoiceOut *pa = (PAVoiceOut *) hw; PAVoiceOut *pa = (PAVoiceOut *) hw;
audio_pt_lock (&pa->pt, AUDIO_FUNC); audio_pt_lock(&pa->pt, __func__);
pa->done = 1; pa->done = 1;
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); audio_pt_join(&pa->pt, &ret, __func__);
if (pa->stream) { if (pa->stream) {
pa_stream_unref (pa->stream); pa_stream_unref (pa->stream);
pa->stream = NULL; pa->stream = NULL;
} }
audio_pt_fini (&pa->pt, AUDIO_FUNC); audio_pt_fini(&pa->pt, __func__);
g_free (pa->pcm_buf); g_free (pa->pcm_buf);
pa->pcm_buf = NULL; pa->pcm_buf = NULL;
} }
@ -687,17 +687,17 @@ static void qpa_fini_in (HWVoiceIn *hw)
void *ret; void *ret;
PAVoiceIn *pa = (PAVoiceIn *) hw; PAVoiceIn *pa = (PAVoiceIn *) hw;
audio_pt_lock (&pa->pt, AUDIO_FUNC); audio_pt_lock(&pa->pt, __func__);
pa->done = 1; pa->done = 1;
audio_pt_unlock_and_signal (&pa->pt, AUDIO_FUNC); audio_pt_unlock_and_signal(&pa->pt, __func__);
audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); audio_pt_join(&pa->pt, &ret, __func__);
if (pa->stream) { if (pa->stream) {
pa_stream_unref (pa->stream); pa_stream_unref (pa->stream);
pa->stream = NULL; pa->stream = NULL;
} }
audio_pt_fini (&pa->pt, AUDIO_FUNC); audio_pt_fini(&pa->pt, __func__);
g_free (pa->pcm_buf); g_free (pa->pcm_buf);
pa->pcm_buf = NULL; pa->pcm_buf = NULL;
} }

View File

@ -277,7 +277,7 @@ static void sdl_callback (void *opaque, Uint8 *buf, int len)
return; return;
} }
if (audio_bug (AUDIO_FUNC, sdl->live < 0 || sdl->live > hw->samples)) { if (audio_bug(__func__, sdl->live < 0 || sdl->live > hw->samples)) {
dolog ("sdl->live=%d hw->samples=%d\n", dolog ("sdl->live=%d hw->samples=%d\n",
sdl->live, hw->samples); sdl->live, hw->samples);
return; return;

View File

@ -139,7 +139,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsettings *as,
audio_pcm_init_info (&hw->info, &wav_as); audio_pcm_init_info (&hw->info, &wav_as);
hw->samples = 1024; hw->samples = 1024;
wav->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); wav->pcm_buf = audio_calloc(__func__, hw->samples, 1 << hw->info.shift);
if (!wav->pcm_buf) { if (!wav->pcm_buf) {
dolog ("Could not allocate buffer (%d bytes)\n", dolog ("Could not allocate buffer (%d bytes)\n",
hw->samples << hw->info.shift); hw->samples << hw->info.shift);

10
cpus.c
View File

@ -259,7 +259,7 @@ int64_t cpu_get_icount_raw(void)
if (cpu && cpu->running) { if (cpu && cpu->running) {
if (!cpu->can_do_io) { if (!cpu->can_do_io) {
fprintf(stderr, "Bad icount read\n"); error_report("Bad icount read");
exit(1); exit(1);
} }
/* Take into account what has run */ /* Take into account what has run */
@ -1181,7 +1181,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
r = kvm_init_vcpu(cpu); r = kvm_init_vcpu(cpu);
if (r < 0) { if (r < 0) {
fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); error_report("kvm_init_vcpu failed: %s", strerror(-r));
exit(1); exit(1);
} }
@ -1211,7 +1211,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
static void *qemu_dummy_cpu_thread_fn(void *arg) static void *qemu_dummy_cpu_thread_fn(void *arg)
{ {
#ifdef _WIN32 #ifdef _WIN32
fprintf(stderr, "qtest is not supported under Windows\n"); error_report("qtest is not supported under Windows");
exit(1); exit(1);
#else #else
CPUState *cpu = arg; CPUState *cpu = arg;
@ -1631,8 +1631,8 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
#else /* _WIN32 */ #else /* _WIN32 */
if (!qemu_cpu_is_self(cpu)) { if (!qemu_cpu_is_self(cpu)) {
if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) { if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) {
fprintf(stderr, "%s: QueueUserAPC failed with error %lu\n", error_report("%s: QueueUserAPC failed with error %lu", __func__,
__func__, GetLastError()); GetLastError());
exit(1); exit(1);
} }
} }

4
exec.c
View File

@ -2216,8 +2216,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
flags, -1, 0); flags, -1, 0);
} }
if (area != vaddr) { if (area != vaddr) {
fprintf(stderr, "Could not remap addr: " error_report("Could not remap addr: "
RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n", RAM_ADDR_FMT "@" RAM_ADDR_FMT "",
length, addr); length, addr);
exit(1); exit(1);
} }

View File

@ -278,7 +278,7 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)
#endif #endif
if (!kernel_filename && !qtest_enabled()) { if (!kernel_filename && !qtest_enabled()) {
fprintf(stderr, "Guest image must be specified (using -kernel)\n"); error_report("Guest image must be specified (using -kernel)");
exit(1); exit(1);
} }

View File

@ -8,6 +8,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include <libfdt.h> #include <libfdt.h>
#include "hw/hw.h" #include "hw/hw.h"
@ -690,7 +691,7 @@ static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,
gsize length; gsize length;
if (!g_file_get_contents(image_name, &contents, &length, NULL)) { if (!g_file_get_contents(image_name, &contents, &length, NULL)) {
fprintf(stderr, "failed to load \"%s\"\n", image_name); error_report("failed to load \"%s\"", image_name);
exit(1); exit(1);
} }
size = length; size = length;
@ -956,8 +957,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)
is_linux = 1; is_linux = 1;
} }
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", info->kernel_filename);
info->kernel_filename);
exit(1); exit(1);
} }
info->entry = entry; info->entry = entry;
@ -976,7 +976,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)
info->initrd_start); info->initrd_start);
} }
if (initrd_size < 0) { if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initrd '%s'\n", error_report("could not load initrd '%s'",
info->initrd_filename); info->initrd_filename);
exit(1); exit(1);
} }
@ -1021,9 +1021,9 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)
} else { } else {
fixupcontext[FIXUP_ARGPTR] = info->loader_start + KERNEL_ARGS_ADDR; fixupcontext[FIXUP_ARGPTR] = info->loader_start + KERNEL_ARGS_ADDR;
if (info->ram_size >= (1ULL << 32)) { if (info->ram_size >= (1ULL << 32)) {
fprintf(stderr, "qemu: RAM size must be less than 4GB to boot" error_report("RAM size must be less than 4GB to boot"
" Linux kernel using ATAGS (try passing a device tree" " Linux kernel using ATAGS (try passing a device tree"
" using -dtb)\n"); " using -dtb)");
exit(1); exit(1);
} }
} }

View File

@ -35,6 +35,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/arm/pxa.h" #include "hw/arm/pxa.h"
#include "net/net.h" #include "net/net.h"
@ -62,8 +63,8 @@ static void connex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0); dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo && !qtest_enabled()) { if (!dinfo && !qtest_enabled()) {
fprintf(stderr, "A flash image must be given with the " error_report("A flash image must be given with the "
"'pflash' parameter\n"); "'pflash' parameter");
exit(1); exit(1);
} }
@ -76,7 +77,7 @@ static void connex_init(MachineState *machine)
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, connex_rom / sector_len, sector_len, connex_rom / sector_len,
2, 0, 0, 0, 0, be)) { 2, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n"); error_report("Error registering flash memory");
exit(1); exit(1);
} }
@ -99,8 +100,8 @@ static void verdex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0); dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo && !qtest_enabled()) { if (!dinfo && !qtest_enabled()) {
fprintf(stderr, "A flash image must be given with the " error_report("A flash image must be given with the "
"'pflash' parameter\n"); "'pflash' parameter");
exit(1); exit(1);
} }
@ -113,7 +114,7 @@ static void verdex_init(MachineState *machine)
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, verdex_rom / sector_len, sector_len, verdex_rom / sector_len,
2, 0, 0, 0, 0, be)) { 2, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n"); error_report("Error registering flash memory");
exit(1); exit(1);
} }

View File

@ -12,6 +12,7 @@
* GNU GPL, version 2 or (at your option) any later version. * GNU GPL, version 2 or (at your option) any later version.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/arm/pxa.h" #include "hw/arm/pxa.h"
@ -143,8 +144,8 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
if (qtest_enabled()) { if (qtest_enabled()) {
break; break;
} }
fprintf(stderr, "Two flash images must be given with the " error_report("Two flash images must be given with the "
"'pflash' parameter\n"); "'pflash' parameter");
exit(1); exit(1);
} }
@ -154,7 +155,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
blk_by_legacy_dinfo(dinfo), blk_by_legacy_dinfo(dinfo),
sector_len, MAINSTONE_FLASH / sector_len, sector_len, MAINSTONE_FLASH / sector_len,
4, 0, 0, 0, 0, be)) { 4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n"); error_report("Error registering flash memory");
exit(1); exit(1);
} }
} }

View File

@ -1627,7 +1627,7 @@ static void musicpal_init(MachineState *machine)
flash_size = blk_getlength(blk); flash_size = blk_getlength(blk);
if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 && if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 &&
flash_size != 32*1024*1024) { flash_size != 32*1024*1024) {
fprintf(stderr, "Invalid flash image size\n"); error_report("Invalid flash image size");
exit(1); exit(1);
} }

View File

@ -18,6 +18,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
@ -2313,7 +2314,7 @@ void omap_uwire_attach(struct omap_uwire_s *s,
uWireSlave *slave, int chipselect) uWireSlave *slave, int chipselect)
{ {
if (chipselect < 0 || chipselect > 3) { if (chipselect < 0 || chipselect > 3) {
fprintf(stderr, "%s: Bad chipselect %i\n", __func__, chipselect); error_report("%s: Bad chipselect %i", __func__, chipselect);
exit(-1); exit(-1);
} }
@ -3987,7 +3988,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
dinfo = drive_get(IF_SD, 0, 0); dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) { if (!dinfo) {
fprintf(stderr, "qemu: missing SecureDigital device\n"); error_report("missing SecureDigital device");
exit(1); exit(1);
} }
s->mmc = omap_mmc_init(0xfffb7800, system_memory, s->mmc = omap_mmc_init(0xfffb7800, system_memory,

View File

@ -19,6 +19,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
@ -2486,7 +2487,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
dinfo = drive_get(IF_SD, 0, 0); dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) { if (!dinfo) {
fprintf(stderr, "qemu: missing SecureDigital device\n"); error_report("missing SecureDigital device");
exit(1); exit(1);
} }
s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9), s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9),

View File

@ -194,7 +194,7 @@ static void sx1_init(MachineState *machine, const int version)
} }
if (!machine->kernel_filename && !fl_idx && !qtest_enabled()) { if (!machine->kernel_filename && !fl_idx && !qtest_enabled()) {
fprintf(stderr, "Kernel or Flash image must be specified\n"); error_report("Kernel or Flash image must be specified");
exit(1); exit(1);
} }

View File

@ -8,6 +8,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
@ -2062,7 +2063,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
s = g_new0(PXA2xxState, 1); s = g_new0(PXA2xxState, 1);
if (strncmp(cpu_type, "pxa27", 5)) { if (strncmp(cpu_type, "pxa27", 5)) {
fprintf(stderr, "Machine requires a PXA27x processor.\n"); error_report("Machine requires a PXA27x processor");
exit(1); exit(1);
} }
@ -2095,7 +2096,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
dinfo = drive_get(IF_SD, 0, 0); dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) { if (!dinfo) {
fprintf(stderr, "qemu: missing SecureDigital device\n"); error_report("missing SecureDigital device");
exit(1); exit(1);
} }
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000, s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,
@ -2220,7 +2221,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
dinfo = drive_get(IF_SD, 0, 0); dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) { if (!dinfo) {
fprintf(stderr, "qemu: missing SecureDigital device\n"); error_report("missing SecureDigital device");
exit(1); exit(1);
} }
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000, s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,

View File

@ -266,7 +266,7 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,
if (ram_size > 0x40000000) { if (ram_size > 0x40000000) {
/* 1GB is the maximum the address space permits */ /* 1GB is the maximum the address space permits */
fprintf(stderr, "vexpress-a9: cannot model more than 1GB RAM\n"); error_report("vexpress-a9: cannot model more than 1GB RAM");
exit(1); exit(1);
} }
@ -355,7 +355,7 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
*/ */
uint64_t rsz = ram_size; uint64_t rsz = ram_size;
if (rsz > (30ULL * 1024 * 1024 * 1024)) { if (rsz > (30ULL * 1024 * 1024 * 1024)) {
fprintf(stderr, "vexpress-a15: cannot model more than 30GB RAM\n"); error_report("vexpress-a15: cannot model more than 30GB RAM");
exit(1); exit(1);
} }
} }
@ -640,7 +640,7 @@ static void vexpress_common_init(MachineState *machine)
pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0", pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
dinfo); dinfo);
if (!pflash0) { if (!pflash0) {
fprintf(stderr, "vexpress: error registering flash 0.\n"); error_report("vexpress: error registering flash 0");
exit(1); exit(1);
} }
@ -655,7 +655,7 @@ static void vexpress_common_init(MachineState *machine)
dinfo = drive_get_next(IF_PFLASH); dinfo = drive_get_next(IF_PFLASH);
if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1", if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1",
dinfo)) { dinfo)) {
fprintf(stderr, "vexpress: error registering flash 1.\n"); error_report("vexpress: error registering flash 1");
exit(1); exit(1);
} }

View File

@ -320,8 +320,8 @@ static void z2_init(MachineState *machine)
#endif #endif
dinfo = drive_get(IF_PFLASH, 0, 0); dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo && !qtest_enabled()) { if (!dinfo && !qtest_enabled()) {
fprintf(stderr, "Flash image must be given with the " error_report("Flash image must be given with the "
"'pflash' parameter\n"); "'pflash' parameter");
exit(1); exit(1);
} }
@ -330,7 +330,7 @@ static void z2_init(MachineState *machine)
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, Z2_FLASH_SIZE / sector_len, sector_len, Z2_FLASH_SIZE / sector_len,
4, 0, 0, 0, 0, be)) { 4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n"); error_report("Error registering flash memory");
exit(1); exit(1);
} }

View File

@ -18,6 +18,7 @@
* with this program; if not, see <http://www.gnu.org/licenses/>. * with this program; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "hw/arm/soc_dma.h" #include "hw/arm/soc_dma.h"
@ -270,9 +271,9 @@ void soc_dma_port_add_fifo(struct soc_dma_s *soc, hwaddr virt_base,
if (entry->type == soc_dma_port_mem) { if (entry->type == soc_dma_port_mem) {
if (entry->addr <= virt_base && if (entry->addr <= virt_base &&
entry->addr + entry->u.mem.size > virt_base) { entry->addr + entry->u.mem.size > virt_base) {
fprintf(stderr, "%s: FIFO at %"PRIx64 error_report("%s: FIFO at %"PRIx64
" collides with RAM region at %"PRIx64 " collides with RAM region at %"PRIx64
"-%"PRIx64 "\n", __func__, "-%"PRIx64, __func__,
virt_base, entry->addr, virt_base, entry->addr,
(entry->addr + entry->u.mem.size)); (entry->addr + entry->u.mem.size));
exit(-1); exit(-1);
@ -284,8 +285,8 @@ void soc_dma_port_add_fifo(struct soc_dma_s *soc, hwaddr virt_base,
while (entry < dma->memmap + dma->memmap_size && while (entry < dma->memmap + dma->memmap_size &&
entry->addr <= virt_base) { entry->addr <= virt_base) {
if (entry->addr == virt_base && entry->u.fifo.out == out) { if (entry->addr == virt_base && entry->u.fifo.out == out) {
fprintf(stderr, "%s: FIFO at %"PRIx64 error_report("%s: FIFO at %"PRIx64
" collides FIFO at %"PRIx64 "\n", " collides FIFO at %"PRIx64,
__func__, virt_base, entry->addr); __func__, virt_base, entry->addr);
exit(-1); exit(-1);
} }
@ -321,9 +322,9 @@ void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base,
if ((entry->addr >= virt_base && entry->addr < virt_base + size) || if ((entry->addr >= virt_base && entry->addr < virt_base + size) ||
(entry->addr <= virt_base && (entry->addr <= virt_base &&
entry->addr + entry->u.mem.size > virt_base)) { entry->addr + entry->u.mem.size > virt_base)) {
fprintf(stderr, "%s: RAM at %"PRIx64 "-%"PRIx64 error_report("%s: RAM at %"PRIx64 "-%"PRIx64
" collides with RAM region at %"PRIx64 " collides with RAM region at %"PRIx64
"-%"PRIx64 "\n", __func__, "-%"PRIx64, __func__,
virt_base, virt_base + size, virt_base, virt_base + size,
entry->addr, entry->addr + entry->u.mem.size); entry->addr, entry->addr + entry->u.mem.size);
exit(-1); exit(-1);
@ -334,10 +335,9 @@ void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base,
} else { } else {
if (entry->addr >= virt_base && if (entry->addr >= virt_base &&
entry->addr < virt_base + size) { entry->addr < virt_base + size) {
fprintf(stderr, "%s: RAM at %"PRIx64 "-%"PRIx64 error_report("%s: RAM at %"PRIx64 "-%"PRIx64
" collides with FIFO at %"PRIx64 " collides with FIFO at %"PRIx64,
"\n", __func__, __func__, virt_base, virt_base + size,
virt_base, virt_base + size,
entry->addr); entry->addr);
exit(-1); exit(-1);
} }

View File

@ -18,6 +18,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
#include "hw/sysbus.h" #include "hw/sysbus.h"
@ -148,8 +149,7 @@ static void lm32_evr_init(MachineState *machine)
} }
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
} }
@ -242,8 +242,7 @@ static void lm32_uclinux_init(MachineState *machine)
} }
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
} }

View File

@ -18,6 +18,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
#include "hw/sysbus.h" #include "hw/sysbus.h"
@ -145,8 +146,7 @@ milkymist_init(MachineState *machine)
/* if no kernel is given no valid bios rom is a fatal error */ /* if no kernel is given no valid bios rom is a fatal error */
if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled()) { if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled()) {
fprintf(stderr, "qemu: could not load Milkymist One bios '%s'\n", error_report("could not load Milkymist One bios '%s'", bios_name);
bios_name);
exit(1); exit(1);
} }
g_free(bios_filename); g_free(bios_filename);
@ -184,8 +184,7 @@ milkymist_init(MachineState *machine)
} }
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
} }

View File

@ -120,7 +120,7 @@ static int64_t load_kernel (CPUMIPSState *env)
(uint64_t *)&kernel_low, (uint64_t *)&kernel_high, (uint64_t *)&kernel_low, (uint64_t *)&kernel_high,
0, EM_MIPS, 1, 0); 0, EM_MIPS, 1, 0);
if (kernel_size < 0) { if (kernel_size < 0) {
error_report("qemu: could not load kernel '%s': %s", error_report("could not load kernel '%s': %s",
loaderparams.kernel_filename, loaderparams.kernel_filename,
load_elf_strerror(kernel_size)); load_elf_strerror(kernel_size));
exit(1); exit(1);
@ -134,8 +134,7 @@ static int64_t load_kernel (CPUMIPSState *env)
if (initrd_size > 0) { if (initrd_size > 0) {
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
if (initrd_offset + initrd_size > ram_size) { if (initrd_offset + initrd_size > ram_size) {
fprintf(stderr, error_report("memory too small for initial ram disk '%s'",
"qemu: memory too small for initial ram disk '%s'\n",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -143,7 +142,7 @@ static int64_t load_kernel (CPUMIPSState *env)
initrd_offset, ram_size - initrd_offset); initrd_offset, ram_size - initrd_offset);
} }
if (initrd_size == (target_ulong) -1) { if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -338,7 +337,7 @@ static void mips_fulong2e_init(MachineState *machine)
isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0));
if (!isa_bus) { if (!isa_bus) {
fprintf(stderr, "vt82c686b_init error\n"); error_report("vt82c686b_init error");
exit(1); exit(1);
} }

View File

@ -268,10 +268,10 @@ static void mips_jazz_init(MachineState *machine,
sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(rc4030, 4)); sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(rc4030, 4));
break; break;
} else if (is_help_option(nd->model)) { } else if (is_help_option(nd->model)) {
fprintf(stderr, "qemu: Supported NICs: dp83932\n"); error_report("Supported NICs: dp83932");
exit(1); exit(1);
} else { } else {
fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); error_report("Unsupported NIC: %s", nd->model);
exit(1); exit(1);
} }
} }

View File

@ -812,7 +812,7 @@ static int64_t load_kernel (void)
NULL, (uint64_t *)&kernel_entry, NULL, NULL, (uint64_t *)&kernel_entry, NULL,
(uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, 0); (uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, 0);
if (kernel_size < 0) { if (kernel_size < 0) {
error_report("qemu: could not load kernel '%s': %s", error_report("could not load kernel '%s': %s",
loaderparams.kernel_filename, loaderparams.kernel_filename,
load_elf_strerror(kernel_size)); load_elf_strerror(kernel_size));
exit(1); exit(1);
@ -846,8 +846,7 @@ static int64_t load_kernel (void)
initrd_offset = (loaderparams.ram_low_size - initrd_size - 131072 initrd_offset = (loaderparams.ram_low_size - initrd_size - 131072
- ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
if (kernel_high >= initrd_offset) { if (kernel_high >= initrd_offset) {
fprintf(stderr, error_report("memory too small for initial ram disk '%s'",
"qemu: memory too small for initial ram disk '%s'\n",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -856,7 +855,7 @@ static int64_t load_kernel (void)
ram_size - initrd_offset); ram_size - initrd_offset);
} }
if (initrd_size == (target_ulong) -1) { if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -1034,8 +1033,7 @@ void mips_malta_init(MachineState *machine)
/* allocate RAM */ /* allocate RAM */
if (ram_size > (2048u << 20)) { if (ram_size > (2048u << 20)) {
fprintf(stderr, error_report("Too much memory for this machine: %dMB, maximum 2048MB",
"qemu: Too much memory for this machine: %d MB, maximum 2048 MB\n",
((unsigned int)ram_size / (1 << 20))); ((unsigned int)ram_size / (1 << 20)));
exit(1); exit(1);
} }

View File

@ -78,7 +78,7 @@ static int64_t load_kernel(void)
if ((entry & ~0x7fffffffULL) == 0x80000000) if ((entry & ~0x7fffffffULL) == 0x80000000)
entry = (int32_t)entry; entry = (int32_t)entry;
} else { } else {
error_report("qemu: could not load kernel '%s': %s", error_report("could not load kernel '%s': %s",
loaderparams.kernel_filename, loaderparams.kernel_filename,
load_elf_strerror(kernel_size)); load_elf_strerror(kernel_size));
exit(1); exit(1);
@ -92,8 +92,7 @@ static int64_t load_kernel(void)
if (initrd_size > 0) { if (initrd_size > 0) {
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
if (initrd_offset + initrd_size > loaderparams.ram_size) { if (initrd_offset + initrd_size > loaderparams.ram_size) {
fprintf(stderr, error_report("memory too small for initial ram disk '%s'",
"qemu: memory too small for initial ram disk '%s'\n",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -101,7 +100,7 @@ static int64_t load_kernel(void)
initrd_offset, loaderparams.ram_size - initrd_offset); initrd_offset, loaderparams.ram_size - initrd_offset);
} }
if (initrd_size == (target_ulong) -1) { if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }

View File

@ -98,7 +98,7 @@ static int64_t load_kernel(void)
if ((entry & ~0x7fffffffULL) == 0x80000000) if ((entry & ~0x7fffffffULL) == 0x80000000)
entry = (int32_t)entry; entry = (int32_t)entry;
} else { } else {
error_report("qemu: could not load kernel '%s': %s", error_report("could not load kernel '%s': %s",
loaderparams.kernel_filename, loaderparams.kernel_filename,
load_elf_strerror(kernel_size)); load_elf_strerror(kernel_size));
exit(1); exit(1);
@ -112,8 +112,7 @@ static int64_t load_kernel(void)
if (initrd_size > 0) { if (initrd_size > 0) {
initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
if (initrd_offset + initrd_size > ram_size) { if (initrd_offset + initrd_size > ram_size) {
fprintf(stderr, error_report("memory too small for initial ram disk '%s'",
"qemu: memory too small for initial ram disk '%s'\n",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -122,7 +121,7 @@ static int64_t load_kernel(void)
ram_size - initrd_offset); ram_size - initrd_offset);
} }
if (initrd_size == (target_ulong) -1) { if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
loaderparams.initrd_filename); loaderparams.initrd_filename);
exit(1); exit(1);
} }
@ -196,8 +195,7 @@ void mips_r4k_init(MachineState *machine)
/* allocate RAM */ /* allocate RAM */
if (ram_size > (256 << 20)) { if (ram_size > (256 << 20)) {
fprintf(stderr, error_report("Too much memory for this machine: %dMB, maximum 256MB",
"qemu: Too much memory for this machine: %d MB, maximum 256 MB\n",
((unsigned int)ram_size / (1 << 20))); ((unsigned int)ram_size / (1 << 20)));
exit(1); exit(1);
} }

View File

@ -63,7 +63,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)
0, 0); 0, 0);
if (kernel_size <= 0) { if (kernel_size <= 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'",
loader_params->kernel_filename); loader_params->kernel_filename);
exit(1); exit(1);
} }
@ -77,8 +77,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)
initrd_offset = (kernel_high + ~TARGET_PAGE_MASK) initrd_offset = (kernel_high + ~TARGET_PAGE_MASK)
& TARGET_PAGE_MASK; & TARGET_PAGE_MASK;
if (initrd_offset + initrd_size > loader_params->ram_size) { if (initrd_offset + initrd_size > loader_params->ram_size) {
fprintf(stderr, error_report("memory too small for initial ram disk '%s'",
"qemu: memory too small for initial ram disk '%s'\n",
loader_params->initrd_filename); loader_params->initrd_filename);
exit(1); exit(1);
} }
@ -87,7 +86,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)
ram_size); ram_size);
} }
if (initrd_size == (target_ulong)-1) { if (initrd_size == (target_ulong)-1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
loader_params->initrd_filename); loader_params->initrd_filename);
exit(1); exit(1);
} }

View File

@ -19,6 +19,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
@ -114,8 +115,7 @@ static void openrisc_load_kernel(ram_addr_t ram_size,
} }
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n", error_report("couldn't load the kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
boot_info.bootstrap_pc = entry; boot_info.bootstrap_pc = entry;

View File

@ -38,7 +38,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/pci/pci.h" #include "hw/pci/pci.h"
#include "hw/i386/pc.h" #include "hw/i386/pc.h"
@ -449,8 +449,8 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr)
regno = (cfgaddr & BONITO_PCICONF_REG_MASK) >> BONITO_PCICONF_REG_OFFSET; regno = (cfgaddr & BONITO_PCICONF_REG_MASK) >> BONITO_PCICONF_REG_OFFSET;
if (idsel == 0) { if (idsel == 0) {
fprintf(stderr, "error in bonito pci config address " TARGET_FMT_plx error_report("error in bonito pci config address " TARGET_FMT_plx
",pcimap_cfg=%x\n", addr, s->regs[BONITO_PCIMAP_CFG]); ",pcimap_cfg=%x", addr, s->regs[BONITO_PCIMAP_CFG]);
exit(1); exit(1);
} }
pciaddr = PCI_ADDR(pci_bus_num(phb->bus), devno, funno, regno); pciaddr = PCI_ADDR(pci_bus_num(phb->bus), devno, funno, regno);

View File

@ -1115,8 +1115,8 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
assert(region_num >= 0); assert(region_num >= 0);
assert(region_num < PCI_NUM_REGIONS); assert(region_num < PCI_NUM_REGIONS);
if (size & (size-1)) { if (size & (size-1)) {
fprintf(stderr, "ERROR: PCI region size must be pow2 " error_report("ERROR: PCI region size must be pow2 "
"type=0x%x, size=0x%"FMT_PCIBUS"\n", type, size); "type=0x%x, size=0x%"FMT_PCIBUS"", type, size);
exit(1); exit(1);
} }

View File

@ -811,7 +811,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
cs = CPU(cpu); cs = CPU(cpu);
if (env->mmu_model != POWERPC_MMU_BOOKE206) { if (env->mmu_model != POWERPC_MMU_BOOKE206) {
fprintf(stderr, "MMU model %i not supported by this machine.\n", error_report("MMU model %i not supported by this machine",
env->mmu_model); env->mmu_model);
exit(1); exit(1);
} }
@ -959,7 +959,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
cur_base, cur_base,
ram_size - cur_base); ram_size - cur_base);
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'",
machine->kernel_filename); machine->kernel_filename);
exit(1); exit(1);
} }
@ -974,7 +974,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
ram_size - initrd_base); ram_size - initrd_base);
if (initrd_size < 0) { if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
machine->initrd_filename); machine->initrd_filename);
exit(1); exit(1);
} }
@ -1016,7 +1016,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
kernel_size = load_uimage(filename, &bios_entry, &loadaddr, NULL, kernel_size = load_uimage(filename, &bios_entry, &loadaddr, NULL,
NULL, NULL); NULL, NULL);
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load firmware '%s'\n", filename); error_report("could not load firmware '%s'", filename);
exit(1); exit(1);
} }
} }
@ -1029,7 +1029,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
initrd_base, initrd_size, initrd_base, initrd_size,
kernel_base, kernel_size); kernel_base, kernel_size);
if (dt_size < 0) { if (dt_size < 0) {
fprintf(stderr, "couldn't load device tree\n"); error_report("couldn't load device tree");
exit(1); exit(1);
} }
assert(dt_size < DTB_MAX_SIZE); assert(dt_size < DTB_MAX_SIZE);

View File

@ -270,7 +270,7 @@ static void ppc_core99_init(MachineState *machine)
} }
} }
if (ppc_boot_device == '\0') { if (ppc_boot_device == '\0') {
fprintf(stderr, "No valid boot device for Mac99 machine\n"); error_report("No valid boot device for Mac99 machine");
exit(1); exit(1);
} }
} }

View File

@ -218,7 +218,7 @@ static void ppc_heathrow_init(MachineState *machine)
#endif #endif
} }
if (ppc_boot_device == '\0') { if (ppc_boot_device == '\0') {
fprintf(stderr, "No valid boot device for G3 Beige machine\n"); error_report("No valid boot device for G3 Beige machine");
exit(1); exit(1);
} }
} }

View File

@ -331,8 +331,7 @@ static void ref405ep_init(MachineState *machine)
kernel_size = load_image_targphys(kernel_filename, kernel_base, kernel_size = load_image_targphys(kernel_filename, kernel_base,
ram_size - kernel_base); ram_size - kernel_base);
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
printf("Load kernel size %ld at " TARGET_FMT_lx, printf("Load kernel size %ld at " TARGET_FMT_lx,
@ -343,7 +342,7 @@ static void ref405ep_init(MachineState *machine)
initrd_size = load_image_targphys(initrd_filename, initrd_base, initrd_size = load_image_targphys(initrd_filename, initrd_base,
ram_size - initrd_base); ram_size - initrd_base);
if (initrd_size < 0) { if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
initrd_filename); initrd_filename);
exit(1); exit(1);
} }
@ -621,8 +620,7 @@ static void taihu_405ep_init(MachineState *machine)
kernel_size = load_image_targphys(kernel_filename, kernel_base, kernel_size = load_image_targphys(kernel_filename, kernel_base,
ram_size - kernel_base); ram_size - kernel_base);
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
/* load initrd */ /* load initrd */
@ -631,8 +629,7 @@ static void taihu_405ep_init(MachineState *machine)
initrd_size = load_image_targphys(initrd_filename, initrd_base, initrd_size = load_image_targphys(initrd_filename, initrd_base,
ram_size - initrd_base); ram_size - initrd_base);
if (initrd_size < 0) { if (initrd_size < 0) {
fprintf(stderr, error_report("could not load initial ram disk '%s'",
"qemu: could not load initial ram disk '%s'\n",
initrd_filename); initrd_filename);
exit(1); exit(1);
} }

View File

@ -12,6 +12,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "net/net.h" #include "net/net.h"
@ -188,7 +189,7 @@ static void bamboo_init(MachineState *machine)
env = &cpu->env; env = &cpu->env;
if (env->mmu_model != POWERPC_MMU_BOOKE) { if (env->mmu_model != POWERPC_MMU_BOOKE) {
fprintf(stderr, "MMU model %i not supported by this machine.\n", error_report("MMU model %i not supported by this machine",
env->mmu_model); env->mmu_model);
exit(1); exit(1);
} }
@ -229,7 +230,7 @@ static void bamboo_init(MachineState *machine)
NULL); NULL);
pcibus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); pcibus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (!pcibus) { if (!pcibus) {
fprintf(stderr, "couldn't create PCI controller!\n"); error_report("couldn't create PCI controller");
exit(1); exit(1);
} }
@ -270,8 +271,7 @@ static void bamboo_init(MachineState *machine)
} }
/* XXX try again as binary */ /* XXX try again as binary */
if (success < 0) { if (success < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
} }
@ -282,7 +282,7 @@ static void bamboo_init(MachineState *machine)
ram_size - RAMDISK_ADDR); ram_size - RAMDISK_ADDR);
if (initrd_size < 0) { if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load ram disk '%s' at %x\n", error_report("could not load ram disk '%s' at %x",
initrd_filename, RAMDISK_ADDR); initrd_filename, RAMDISK_ADDR);
exit(1); exit(1);
} }
@ -292,7 +292,7 @@ static void bamboo_init(MachineState *machine)
if (kernel_filename) { if (kernel_filename) {
if (bamboo_load_device_tree(FDT_ADDR, ram_size, RAMDISK_ADDR, if (bamboo_load_device_tree(FDT_ADDR, ram_size, RAMDISK_ADDR,
initrd_size, kernel_cmdline) < 0) { initrd_size, kernel_cmdline) < 0) {
fprintf(stderr, "couldn't load device tree\n"); error_report("couldn't load device tree");
exit(1); exit(1);
} }
} }

View File

@ -574,7 +574,7 @@ static void ppc_prep_init(MachineState *machine)
} }
} }
if (ppc_boot_device == '\0') { if (ppc_boot_device == '\0') {
fprintf(stderr, "No valid boot device for Mac99 machine\n"); error_report("No valid boot device for Mac99 machine");
exit(1); exit(1);
} }
} }
@ -595,7 +595,7 @@ static void ppc_prep_init(MachineState *machine)
qdev_init_nofail(dev); qdev_init_nofail(dev);
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (pci_bus == NULL) { if (pci_bus == NULL) {
fprintf(stderr, "Couldn't create PCI host controller.\n"); error_report("Couldn't create PCI host controller");
exit(1); exit(1);
} }
sysctrl->contiguous_map_irq = qdev_get_gpio_in(dev, 0); sysctrl->contiguous_map_irq = qdev_get_gpio_in(dev, 0);

View File

@ -223,7 +223,7 @@ static void virtex_init(MachineState *machine)
env = &cpu->env; env = &cpu->env;
if (env->mmu_model != POWERPC_MMU_BOOKE) { if (env->mmu_model != POWERPC_MMU_BOOKE) {
fprintf(stderr, "MMU model %i not supported by this machine.\n", error_report("MMU model %i not supported by this machine",
env->mmu_model); env->mmu_model);
exit(1); exit(1);
} }

View File

@ -1564,9 +1564,10 @@ send_response:
if (rsplen) { if (rsplen) {
int i; int i;
DPRINTF("Response:"); DPRINTF("Response:");
for (i = 0; i < rsplen; i++) for (i = 0; i < rsplen; i++) {
fprintf(stderr, " %02x", response[i]); DPRINTF(" %02x", response[i]);
fprintf(stderr, " state %d\n", sd->state); }
DPRINTF(" state %d\n", sd->state);
} else { } else {
DPRINTF("No response %d\n", sd->state); DPRINTF("No response %d\n", sd->state);
} }

View File

@ -22,6 +22,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
@ -139,8 +140,7 @@ static void leon3_generic_hw_init(MachineState *machine)
/* Allocate RAM */ /* Allocate RAM */
if ((uint64_t)ram_size > (1UL << 30)) { if ((uint64_t)ram_size > (1UL << 30)) {
fprintf(stderr, error_report("Too much memory for this machine: %d, maximum 1G",
"qemu: Too much memory for this machine: %d, maximum 1G\n",
(unsigned int)(ram_size / (1024 * 1024))); (unsigned int)(ram_size / (1024 * 1024)));
exit(1); exit(1);
} }
@ -167,19 +167,18 @@ static void leon3_generic_hw_init(MachineState *machine)
} }
if (bios_size > prom_size) { if (bios_size > prom_size) {
fprintf(stderr, "qemu: could not load prom '%s': file too big\n", error_report("could not load prom '%s': file too big", filename);
filename);
exit(1); exit(1);
} }
if (bios_size > 0) { if (bios_size > 0) {
ret = load_image_targphys(filename, 0x00000000, bios_size); ret = load_image_targphys(filename, 0x00000000, bios_size);
if (ret < 0 || ret > prom_size) { if (ret < 0 || ret > prom_size) {
fprintf(stderr, "qemu: could not load prom '%s'\n", filename); error_report("could not load prom '%s'", filename);
exit(1); exit(1);
} }
} else if (kernel_filename == NULL && !qtest_enabled()) { } else if (kernel_filename == NULL && !qtest_enabled()) {
fprintf(stderr, "Can't read bios image %s\n", filename); error_report("Can't read bios image %s", filename);
exit(1); exit(1);
} }
g_free(filename); g_free(filename);
@ -192,8 +191,7 @@ static void leon3_generic_hw_init(MachineState *machine)
kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL, kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL,
1 /* big endian */, EM_SPARC, 0, 0); 1 /* big endian */, EM_SPARC, 0, 0);
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
if (bios_size <= 0) { if (bios_size <= 0) {

View File

@ -259,8 +259,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
KERNEL_LOAD_ADDR, KERNEL_LOAD_ADDR,
RAM_size - KERNEL_LOAD_ADDR); RAM_size - KERNEL_LOAD_ADDR);
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
@ -271,7 +270,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
INITRD_LOAD_ADDR, INITRD_LOAD_ADDR,
RAM_size - INITRD_LOAD_ADDR); RAM_size - INITRD_LOAD_ADDR);
if (initrd_size < 0) { if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
initrd_filename); initrd_filename);
exit(1); exit(1);
} }
@ -680,7 +679,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
ret = -1; ret = -1;
} }
if (ret < 0 || ret > PROM_SIZE_MAX) { if (ret < 0 || ret > PROM_SIZE_MAX) {
fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name); error_report("could not load prom '%s'", bios_name);
exit(1); exit(1);
} }
} }
@ -746,8 +745,7 @@ static void ram_init(hwaddr addr, ram_addr_t RAM_size,
/* allocate RAM */ /* allocate RAM */
if ((uint64_t)RAM_size > max_mem) { if ((uint64_t)RAM_size > max_mem) {
fprintf(stderr, error_report("Too much memory for this machine: %d, maximum %d",
"qemu: Too much memory for this machine: %d, maximum %d\n",
(unsigned int)(RAM_size / (1024 * 1024)), (unsigned int)(RAM_size / (1024 * 1024)),
(unsigned int)(max_mem / (1024 * 1024))); (unsigned int)(max_mem / (1024 * 1024)));
exit(1); exit(1);

View File

@ -152,7 +152,7 @@ static void niagara_init(MachineState *machine)
dinfo->is_default = 1; dinfo->is_default = 1;
rom_add_file_fixed(blk_bs(blk)->filename, NIAGARA_VDISK_BASE, -1); rom_add_file_fixed(blk_bs(blk)->filename, NIAGARA_VDISK_BASE, -1);
} else { } else {
fprintf(stderr, "qemu: could not load ram disk '%s'\n", error_report("could not load ram disk '%s'",
blk_bs(blk)->filename); blk_bs(blk)->filename);
exit(1); exit(1);
} }

View File

@ -22,6 +22,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "cpu.h" #include "cpu.h"
@ -168,8 +169,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
RAM_size - KERNEL_LOAD_ADDR); RAM_size - KERNEL_LOAD_ADDR);
} }
if (kernel_size < 0) { if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", error_report("could not load kernel '%s'", kernel_filename);
kernel_filename);
exit(1); exit(1);
} }
/* load initrd above kernel */ /* load initrd above kernel */
@ -181,7 +181,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
*initrd_addr, *initrd_addr,
RAM_size - *initrd_addr); RAM_size - *initrd_addr);
if ((int)*initrd_size < 0) { if ((int)*initrd_size < 0) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", error_report("could not load initial ram disk '%s'",
initrd_filename); initrd_filename);
exit(1); exit(1);
} }
@ -422,7 +422,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
ret = -1; ret = -1;
} }
if (ret < 0 || ret > PROM_SIZE_MAX) { if (ret < 0 || ret > PROM_SIZE_MAX) {
fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name); error_report("could not load prom '%s'", bios_name);
exit(1); exit(1);
} }
} }

View File

@ -9,6 +9,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "hw/xen/xen_backend.h" #include "hw/xen/xen_backend.h"
#include "qmp-commands.h" #include "qmp-commands.h"
#include "chardev/char.h" #include "chardev/char.h"
@ -96,13 +97,13 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
char path[50]; char path[50];
if (xs == NULL) { if (xs == NULL) {
fprintf(stderr, "xenstore connection not initialized\n"); error_report("xenstore connection not initialized");
exit(1); exit(1);
} }
snprintf(path, sizeof (path), "device-model/%u/state", xen_domid); snprintf(path, sizeof (path), "device-model/%u/state", xen_domid);
if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) { if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) {
fprintf(stderr, "error recording dm state\n"); error_report("error recording dm state");
exit(1); exit(1);
} }
} }

View File

@ -23,6 +23,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "hw/xen/xen_backend.h" #include "hw/xen/xen_backend.h"
@ -36,7 +37,7 @@ static void xen_init_pv(MachineState *machine)
/* Initialize backend core & drivers */ /* Initialize backend core & drivers */
if (xen_be_init() != 0) { if (xen_be_init() != 0) {
fprintf(stderr, "%s: xen backend core setup failed\n", __func__); error_report("%s: xen backend core setup failed", __func__);
exit(1); exit(1);
} }
@ -51,18 +52,18 @@ static void xen_init_pv(MachineState *machine)
const char *initrd_filename = machine->initrd_filename; const char *initrd_filename = machine->initrd_filename;
if (xen_domain_build_pv(kernel_filename, initrd_filename, if (xen_domain_build_pv(kernel_filename, initrd_filename,
kernel_cmdline) < 0) { kernel_cmdline) < 0) {
fprintf(stderr, "xen pv domain creation failed\n"); error_report("xen pv domain creation failed");
exit(1); exit(1);
} }
break; break;
} }
#endif #endif
case XEN_EMULATE: case XEN_EMULATE:
fprintf(stderr, "xen emulation not implemented (yet)\n"); error_report("xen emulation not implemented (yet)");
exit(1); exit(1);
break; break;
default: default:
fprintf(stderr, "unhandled xen_mode %d\n", xen_mode); error_report("unhandled xen_mode %d", xen_mode);
exit(1); exit(1);
break; break;
} }

View File

@ -230,6 +230,12 @@ void error_prepend(Error **errp, const char *fmt, ...)
/* /*
* Append a printf-style human-readable explanation to an existing error. * Append a printf-style human-readable explanation to an existing error.
* If the error is later reported to a human user with
* error_report_err() or warn_report_err(), the hints will be shown,
* too. If it's reported via QMP, the hints will be ignored.
* Intended use is adding helpful hints on the human user interface,
* e.g. a list of valid values. It's not for clarifying a confusing
* error message.
* @errp may be NULL, but not &error_fatal or &error_abort. * @errp may be NULL, but not &error_fatal or &error_abort.
* Trivially the case if you call it only after error_setg() or * Trivially the case if you call it only after error_setg() or
* error_propagate(). * error_propagate().
@ -267,11 +273,13 @@ void error_free_or_abort(Error **errp);
/* /*
* Convenience function to warn_report() and free @err. * Convenience function to warn_report() and free @err.
* The report includes hints added with error_append_hint().
*/ */
void warn_report_err(Error *err); void warn_report_err(Error *err);
/* /*
* Convenience function to error_report() and free @err. * Convenience function to error_report() and free @err.
* The report includes hints added with error_append_hint().
*/ */
void error_report_err(Error *err); void error_report_err(Error *err);

2
vl.c
View File

@ -2172,7 +2172,7 @@ static DisplayType select_display(const char *p)
display_opengl = 1; display_opengl = 1;
display = DT_EGL; display = DT_EGL;
#else #else
fprintf(stderr, "egl support is disabled\n"); error_report("egl support is disabled");
exit(1); exit(1);
#endif #endif
} else if (strstart(p, "curses", &opts)) { } else if (strstart(p, "curses", &opts)) {