Skip to content

Commit fe9340b

Browse files
committed
GDB stub should return data with endianess of the host machine.
1 parent 9ea6295 commit fe9340b

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

contrib/plugins/bap-tracing/tracing.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <stdio.h>
66
#include <string.h>
77

8+
#include "compiler.h"
89
#include "frame_arch.h"
910
#include "frame_buffer.h"
1011
#include "qemu-plugin.h"
@@ -53,7 +54,7 @@ static void add_post_reg_state(VCPU *vcpu, unsigned int vcpu_index,
5354
&g_array_index(current_regs, qemu_plugin_reg_descriptor, i);
5455
int s = qemu_plugin_read_register(reg->handle, rdata);
5556
assert(s == prev_reg->content->len);
56-
swap_to_le(rdata->data, s, state.is_big_endian);
57+
swap_to_le(rdata->data, s, HOST_BIG_ENDIAN);
5758
if (!memcmp(rdata->data, prev_reg->content->data, s)) {
5859
// No change
5960
// Flush byte array
@@ -82,7 +83,7 @@ static void add_pre_reg_state(VCPU *vcpu, unsigned int vcpu_index,
8283
g_assert(!strcmp(prev_reg->name, reg->name) &&
8384
prev_reg->handle == reg->handle);
8485
memcpy_le(prev_reg->content->data, rdata->data, prev_reg->content->len,
85-
state.is_big_endian);
86+
HOST_BIG_ENDIAN);
8687
frame_buffer_append_reg_info(fbuf, reg->name, rdata, s, OperandRead);
8788
// Flush byte array
8889
g_byte_array_set_size(rdata, 0);
@@ -341,14 +342,6 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
341342
qemu_plugin_outs("Pass it with 'out=<output_file>'.\n\n");
342343
exit(1);
343344
}
344-
char *endianess = get_argv_val(argv, argc, "endianess");
345-
if (!endianess || (strcmp(endianess, "b") && strcmp(endianess, "l"))) {
346-
qemu_plugin_outs("'endianess' argument is missing or is not 'b' or 'l'.\n");
347-
qemu_plugin_outs("This is required until QEMU plugins get a richer API.\n");
348-
qemu_plugin_outs("Pass it with 'endianess=[b/l]'.\n\n");
349-
exit(1);
350-
}
351-
state.is_big_endian = endianess[0] == 'b';
352345

353346
state.target_name = g_strdup(info->target_name);
354347
state.frame_buffer = g_ptr_array_new();

contrib/plugins/bap-tracing/tracing.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ typedef struct {
171171
GPtrArray /*<const char *>*/ *vcpu_modes; ///< Indexed by vcpu id.
172172

173173
const char *target_name;
174-
bool is_big_endian;
175174
} TraceState;
176175

177176
VCPU *vcpu_new(void);

0 commit comments

Comments
 (0)