Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-updates-250521-2' into staging

Testing, gdbstub and plugin updates

  - ensure gitlab references master registry
  - add special rule for hexagon image
  - clean-up gdbstub's argument handling
  - fix replay HMP commands to accept long icount
  - minor re-factor of gdbstub replay handling
  - update syscall plugin to be more useful

# gpg: Signature made Tue 25 May 2021 16:55:16 BST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-and-misc-updates-250521-2:
  plugins/syscall: Added a table-like summary output
  gdbstub: tidy away reverse debugging check into function
  hmp-commands: expand type of icount to "l" in replay commands
  gdbstub: Replace GdbCmdContext with plain g_array()
  gdbstub: Constify GdbCmdParseEntry
  gitlab: add special rule for the hexagon container
  gitlab: explicitly reference the upstream registry

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2021-05-25 17:31:04 +01:00
5 changed files with 298 additions and 185 deletions
+29 -2
View File
@@ -12,10 +12,9 @@
script:
- echo "TAG:$TAG"
- echo "COMMON_TAG:$COMMON_TAG"
- docker pull "$TAG" || docker pull "$COMMON_TAG" || true
- ./tests/docker/docker.py --engine docker build
-t "qemu/$NAME" -f "tests/docker/dockerfiles/$NAME.docker"
-r $CI_REGISTRY_IMAGE
-r $CI_REGISTRY/qemu-project/qemu
- docker tag "qemu/$NAME" "$TAG"
- docker push "$TAG"
after_script:
@@ -102,6 +101,34 @@ armhf-debian-cross-container:
variables:
NAME: debian-armhf-cross
# We never want to build hexagon in the CI system and by default we
# always want to refer to the master registry where it lives.
hexagon-cross-container:
image: docker:stable
stage: containers
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project"'
when: never
- when: always
variables:
NAME: debian-hexagon-cross
GIT_DEPTH: 1
services:
- docker:dind
before_script:
- export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
- export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
- docker info
- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
script:
- echo "TAG:$TAG"
- echo "COMMON_TAG:$COMMON_TAG"
- docker pull $COMMON_TAG
- docker tag $COMMON_TAG $TAG
- docker push "$TAG"
after_script:
- docker logout
hppa-debian-cross-container:
extends: .container_job_template
stage: containers-layer2
+4 -1
View File
@@ -417,10 +417,13 @@ build-user-static:
MAKE_CHECK_ARGS: check-tcg
# Because the hexagon cross-compiler takes so long to build we don't rely
# on the CI system to build it and hence this job has no dependency
# on the CI system to build it and hence this job has an optional dependency
# declared. The image is manually uploaded.
build-user-hexagon:
extends: .native_build_job_template
needs:
job: hexagon-cross-container
optional: true
variables:
IMAGE: debian-hexagon-cross
TARGETS: hexagon-linux-user
+169 -174
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1667,7 +1667,7 @@ ERST
{
.name = "replay_break",
.args_type = "icount:i",
.args_type = "icount:l",
.params = "icount",
.help = "set breakpoint at the specified instruction count",
.cmd = hmp_replay_break,
@@ -1699,7 +1699,7 @@ ERST
{
.name = "replay_seek",
.args_type = "icount:i",
.args_type = "icount:l",
.params = "icount",
.help = "replay execution to the specified instruction count",
.cmd = hmp_replay_seek,
+94 -6
View File
@@ -16,32 +16,120 @@
QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
typedef struct {
int64_t num;
int64_t calls;
int64_t errors;
} SyscallStats;
static GMutex lock;
static GHashTable *statistics;
static SyscallStats *get_or_create_entry(int64_t num)
{
SyscallStats *entry =
(SyscallStats *) g_hash_table_lookup(statistics, GINT_TO_POINTER(num));
if (!entry) {
entry = g_new0(SyscallStats, 1);
entry->num = num;
g_hash_table_insert(statistics, GINT_TO_POINTER(num), (gpointer) entry);
}
return entry;
}
static void vcpu_syscall(qemu_plugin_id_t id, unsigned int vcpu_index,
int64_t num, uint64_t a1, uint64_t a2,
uint64_t a3, uint64_t a4, uint64_t a5,
uint64_t a6, uint64_t a7, uint64_t a8)
{
g_autofree gchar *out = g_strdup_printf("syscall #%" PRIi64 "\n", num);
qemu_plugin_outs(out);
if (statistics) {
SyscallStats *entry;
g_mutex_lock(&lock);
entry = get_or_create_entry(num);
entry->calls++;
g_mutex_unlock(&lock);
} else {
g_autofree gchar *out = g_strdup_printf("syscall #%" PRIi64 "\n", num);
qemu_plugin_outs(out);
}
}
static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx,
int64_t num, int64_t ret)
{
if (statistics) {
SyscallStats *entry;
g_mutex_lock(&lock);
/* Should always return an existent entry. */
entry = get_or_create_entry(num);
if (ret < 0) {
entry->errors++;
}
g_mutex_unlock(&lock);
} else {
g_autofree gchar *out;
out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n",
num, ret);
qemu_plugin_outs(out);
}
}
static void print_entry(gpointer val, gpointer user_data)
{
g_autofree gchar *out;
out = g_strdup_printf("syscall #%" PRIi64 " returned -> %" PRIi64 "\n",
num, ret);
SyscallStats *entry = (SyscallStats *) val;
int64_t syscall_num = entry->num;
out = g_strdup_printf(
"%-13" PRIi64 "%-6" PRIi64 " %" PRIi64 "\n",
syscall_num, entry->calls, entry->errors);
qemu_plugin_outs(out);
}
/* ************************************************************************* */
static gint comp_func(gconstpointer ea, gconstpointer eb)
{
SyscallStats *ent_a = (SyscallStats *) ea;
SyscallStats *ent_b = (SyscallStats *) eb;
static void plugin_exit(qemu_plugin_id_t id, void *p) {}
return ent_a->calls > ent_b->calls ? -1 : 1;
}
/* ************************************************************************* */
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
if (!statistics) {
return;
}
g_mutex_lock(&lock);
GList *entries = g_hash_table_get_values(statistics);
entries = g_list_sort(entries, comp_func);
qemu_plugin_outs("syscall no. calls errors\n");
g_list_foreach(entries, print_entry, NULL);
g_list_free(entries);
g_hash_table_destroy(statistics);
g_mutex_unlock(&lock);
}
QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
const qemu_info_t *info,
int argc, char **argv)
{
if (argc == 0) {
statistics = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free);
} else {
for (int i = 0; i < argc; i++) {
if (g_strcmp0(argv[i], "print") != 0) {
fprintf(stderr, "unsupported argument: %s\n", argv[i]);
return -1;
}
}
}
qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall);
qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret);
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);