Skip to content

Commit 73995d1

Browse files
committed
Merge remote-tracking branch 'remotes/stsquad/tags/pull-more-fixes-150420-1' into staging
More small fixes for rc3 - tweak docker FEATURE flags for document building - include sphinx configure check in config.log - disable PIE for Windows builds - fix /proc/self/stat handling - a number of gdbstub fixups following GByteArray conversion # gpg: Signature made Wed 15 Apr 2020 11:38:56 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-more-fixes-150420-1: gdbstub: Introduce gdb_get_float32() to get 32-bit float registers gdbstub: Do not use memset() on GByteArray gdbstub: i386: Fix gdb_get_reg16() parameter to unbreak gdb target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray linux-user: fix /proc/self/stat handling configure: disable PIE for Windows builds configure: redirect sphinx-build check to config.log tests/docker: add docs FEATURE flag and use for test-misc Signed-off-by: Peter Maydell <[email protected]>
2 parents 2f7cc1f + 377f8f0 commit 73995d1

File tree

15 files changed

+57
-44
lines changed

15 files changed

+57
-44
lines changed

configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ MINGW32*)
807807
audio_drv_list=""
808808
fi
809809
supported_os="yes"
810+
pie="no"
810811
;;
811812
GNU/kFreeBSD)
812813
bsd="yes"
@@ -4942,7 +4943,9 @@ has_sphinx_build() {
49424943
# sphinx-build doesn't exist at all or if it is too old.
49434944
mkdir -p "$TMPDIR1/sphinx"
49444945
touch "$TMPDIR1/sphinx/index.rst"
4945-
"$sphinx_build" $sphinx_werror -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
4946+
"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
4947+
-b html "$TMPDIR1/sphinx" \
4948+
"$TMPDIR1/sphinx/out" >> config.log 2>&1
49464949
}
49474950

49484951
# Check if tools are available to build documentation.

include/exec/gdbstub.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,24 @@ static inline int gdb_get_reg128(GByteArray *buf, uint64_t val_hi,
125125
return 16;
126126
}
127127

128+
static inline int gdb_get_float32(GByteArray *array, float32 val)
129+
{
130+
uint8_t buf[sizeof(CPU_FloatU)];
131+
132+
stfl_p(buf, val);
133+
g_byte_array_append(array, buf, sizeof(buf));
134+
135+
return sizeof(buf);
136+
}
137+
static inline int gdb_get_zeroes(GByteArray *array, size_t len)
138+
{
139+
guint oldlen = array->len;
140+
g_byte_array_set_size(array, oldlen + len);
141+
memset(array->data + oldlen, 0, len);
142+
143+
return len;
144+
}
145+
128146
/**
129147
* gdb_get_reg_ptr: get pointer to start of last element
130148
* @len: length of element

linux-user/syscall.c

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7295,34 +7295,29 @@ static int open_self_stat(void *cpu_env, int fd)
72957295
{
72967296
CPUState *cpu = env_cpu((CPUArchState *)cpu_env);
72977297
TaskState *ts = cpu->opaque;
7298-
abi_ulong start_stack = ts->info->start_stack;
7298+
g_autoptr(GString) buf = g_string_new(NULL);
72997299
int i;
73007300

73017301
for (i = 0; i < 44; i++) {
7302-
char buf[128];
7303-
int len;
7304-
uint64_t val = 0;
7305-
7306-
if (i == 0) {
7307-
/* pid */
7308-
val = getpid();
7309-
snprintf(buf, sizeof(buf), "%"PRId64 " ", val);
7310-
} else if (i == 1) {
7311-
/* app name */
7312-
snprintf(buf, sizeof(buf), "(%s) ", ts->bprm->argv[0]);
7313-
} else if (i == 27) {
7314-
/* stack bottom */
7315-
val = start_stack;
7316-
snprintf(buf, sizeof(buf), "%"PRId64 " ", val);
7317-
} else {
7318-
/* for the rest, there is MasterCard */
7319-
snprintf(buf, sizeof(buf), "0%c", i == 43 ? '\n' : ' ');
7320-
}
7302+
if (i == 0) {
7303+
/* pid */
7304+
g_string_printf(buf, FMT_pid " ", getpid());
7305+
} else if (i == 1) {
7306+
/* app name */
7307+
gchar *bin = g_strrstr(ts->bprm->argv[0], "/");
7308+
bin = bin ? bin + 1 : ts->bprm->argv[0];
7309+
g_string_printf(buf, "(%.15s) ", bin);
7310+
} else if (i == 27) {
7311+
/* stack bottom */
7312+
g_string_printf(buf, TARGET_ABI_FMT_ld " ", ts->info->start_stack);
7313+
} else {
7314+
/* for the rest, there is MasterCard */
7315+
g_string_printf(buf, "0%c", i == 43 ? '\n' : ' ');
7316+
}
73217317

7322-
len = strlen(buf);
7323-
if (write(fd, buf, len) != len) {
7324-
return -1;
7325-
}
7318+
if (write(fd, buf->str, buf->len) != buf->len) {
7319+
return -1;
7320+
}
73267321
}
73277322

73287323
return 0;

target/arm/gdbstub.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ int arm_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
4747
if (gdb_has_xml) {
4848
return 0;
4949
}
50-
memset(mem_buf, 0, 12);
51-
return 12;
50+
return gdb_get_zeroes(mem_buf, 12);
5251
}
5352
switch (n) {
5453
case 24:

target/i386/gdbstub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
106106
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
107107
floatx80 *fp = (floatx80 *) &env->fpregs[n - IDX_FP_REGS];
108108
int len = gdb_get_reg64(mem_buf, cpu_to_le64(fp->low));
109-
len += gdb_get_reg16(mem_buf + len, cpu_to_le16(fp->high));
109+
len += gdb_get_reg16(mem_buf, cpu_to_le16(fp->high));
110110
return len;
111111
} else if (n >= IDX_XMM_REGS && n < IDX_XMM_REGS + CPU_NB_REGS) {
112112
n -= IDX_XMM_REGS;

target/m68k/helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
109109
{
110110
if (n < 8) {
111111
int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
112-
len += gdb_get_reg16(mem_buf + len, 0);
113-
len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
112+
len += gdb_get_reg16(mem_buf, 0);
113+
len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
114114
return len;
115115
}
116116
switch (n) {

target/sh4/gdbstub.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ int superh_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
5858
return gdb_get_regl(mem_buf, env->fpscr);
5959
case 25 ... 40:
6060
if (env->fpscr & FPSCR_FR) {
61-
stfl_p(mem_buf, env->fregs[n - 9]);
62-
} else {
63-
stfl_p(mem_buf, env->fregs[n - 25]);
61+
return gdb_get_float32(mem_buf, env->fregs[n - 9]);
6462
}
65-
return 4;
63+
return gdb_get_float32(mem_buf, env->fregs[n - 25]);
6664
case 41:
6765
return gdb_get_regl(mem_buf, env->ssr);
6866
case 42:

target/xtensa/gdbstub.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ int xtensa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
105105
default:
106106
qemu_log_mask(LOG_UNIMP, "%s from reg %d of unsupported size %d\n",
107107
__func__, n, reg->size);
108-
memset(mem_buf, 0, reg->size);
109-
return reg->size;
108+
return gdb_get_zeroes(mem_buf, reg->size);
110109
}
111110

112111
case xtRegisterTypeWindow: /*a*/
@@ -115,8 +114,7 @@ int xtensa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
115114
default:
116115
qemu_log_mask(LOG_UNIMP, "%s from reg %d of unsupported type %d\n",
117116
__func__, n, reg->type);
118-
memset(mem_buf, 0, reg->size);
119-
return reg->size;
117+
return gdb_get_zeroes(mem_buf, reg->size);
120118
}
121119
}
122120

tests/docker/dockerfiles/debian10.docker

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ RUN apt update && \
3434
python3-sphinx \
3535
texinfo \
3636
$(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\ -f2)
37+
38+
ENV FEATURES docs

tests/docker/dockerfiles/debian9.docker

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,4 @@ RUN apt update && \
3030
pkg-config \
3131
psmisc \
3232
python3 \
33-
python3-sphinx \
34-
texinfo \
3533
$(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\ -f2)

0 commit comments

Comments
 (0)