From patchwork Thu Jun 27 04:13:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 807807 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp613225wrn; Wed, 26 Jun 2024 21:17:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVCilsMRAO+DL7hCUg2xGFh2rXgjUqpfzoteSCBHTDCEg8AHdMAj/1TGzTYXafNWkbU0kT5YaKyNEq5K/R2mYWu X-Google-Smtp-Source: AGHT+IH7JngiMDr7N0bNGHBJiEpJFHMQqS7Tjz3t7fM96clDmzYOwsvF01oWu2V5LgPpD+l29PHv X-Received: by 2002:a05:620a:1998:b0:79d:5503:a92a with SMTP id af79cd13be357-79d5503afdfmr416391385a.10.1719461827933; Wed, 26 Jun 2024 21:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719461827; cv=none; d=google.com; s=arc-20160816; b=HxIJHv005KlHuI54oONgDcMvBQTwhDnpiVkcFO91emMFJk/hURJI6D3spN5icYnWel 2TRdAP1eg5gLzypeCyuwUEpqYhEZqIdbY012Pk/b5sOB8NXlcllh81C/cyhBcdnK+4x5 AaYlsFc2qGiHUlYfv5HBCRBUZSC1YNHukZ0aG1JYhSmhGH4XW4fcWOzvW5f3aUxV2PF6 upOvekqNdHE/w9FECkZjsymAjDkQihP++I3yqUH8MxfMaW/W1zl6gnobVKZEYyUjIfSw jF6xLx7vpSMIuhiHZv8e/soSAUFUoB5XGJMZOztqAM2cF8/gC6q61MbSuC0S/AbJ0pP1 8RqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wwLPKvfEsT814DRwG9Ogl9FVhlLvakaUgV980nIKtT0=; fh=fQSRkfw+DkTHa5KQssXieneufL+rl3wPoA2jkVIsZpk=; b=M/4jmUw9jcq01t1/WApgu316n670nZzJdgiqYn0+S+KJjWBWIHaK2mHZeVrZVpuZ+v wkMN1Vb5/cZEM/zhrbcUomBDDCei8BdrpvzBLDVUxuhhFuVCDQfLIianJF47A6R7K0uB vgOLkIyMy3HP9jo8vG9v90zkpzipy57MNKZGGGNzLyfrb+TsJEc88Hoqt21JOwjlyt/O o1qHdC0L1KoHf2hce2dS0ChUMQrpJMSw3Y8zfN6ZFB6S/JFC5Fb9zhrpKqSDcMSGjQLp IefTS2NQCIo5BezFAGYIEIz6enxH90mvSPA2gjWv4cnoySkvXYfv17QdgE7ZYCvydQlN d++Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ocsoLMF7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d5c7eec2esi55961285a.215.2024.06.26.21.17.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jun 2024 21:17:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ocsoLMF7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMgX8-0006di-Ey; Thu, 27 Jun 2024 00:14:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMgWk-0006Hw-GZ for qemu-devel@nongnu.org; Thu, 27 Jun 2024 00:14:34 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMgWh-0000Ar-N0 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 00:14:30 -0400 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3d5666a4860so256457b6e.2 for ; Wed, 26 Jun 2024 21:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719461666; x=1720066466; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wwLPKvfEsT814DRwG9Ogl9FVhlLvakaUgV980nIKtT0=; b=ocsoLMF7j8VQ/pmW7TPqjKhSB97y2LOq4teJDgJxBfaqcaJTAYBHCuz5rZDlO6tcLc zGLyFFPSisi5TYxTtbSbaEthYbYkynKg9BFausanBTYt4EEaE1Y51nF6wblud7JXKlND HocKsGs+9CwUU0n1oiNO/KmgoqP2xeBvvRhCunajpFuGgxsE0+DsEP8Htq8IimdCHBfc UFheA7pI5ltPMduLv1ITMjM9gDK3t0orhTlR1HriCPuDc3ickPaHB87N/PS4E4fwbIYg XJxvlD+53U5V2s8JedHDosHy/BlbczdNKZrHP+rSrUKA2BQcrGciv8ty37/uid/RJrI2 gkNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719461666; x=1720066466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wwLPKvfEsT814DRwG9Ogl9FVhlLvakaUgV980nIKtT0=; b=SaKsz217AYP4kMzYuvpVWiEHR0ekrWtxYM1eQvRZU5I/5BzvZAsndWRsZ1Kp2EUpNb 9YwhKRx/5mIdttyNib52sNRO4baVt7jR4LyLUTrKUuqoesxUdpfUiWeKI5WyRUS702Xd 3aSPdlQD6USCKjpomDE6he/6mFoOB0JvcufSH2L1RmDK8ov/LZQ34sWnBtzGKP3+mRv4 fm00RVrqbSL6GIcsGsa8/QqnB9t29F4j8M/F+ufc2o8ytIIBVz2S/RqhxotV0EratTgF EQDXMrSvjr4/Gp9RhxjnytcuLvnTTImIJbNVqA+ph2zsXGfkwJG3FkRxlbXIfZztK2yK WK1g== X-Gm-Message-State: AOJu0Yy+dAw4mBWxfZanw5WocRSXOFk4FC4bEeW7yczNpqslWT0Kz6By dM7mRAx2JaS0lp01U6nh4QO7kohTuuAzOfx3CGapR9d9SLZczD57plXHYRtM4mDIBVwiZYm0/G0 8TrQ= X-Received: by 2002:a05:6808:114f:b0:3d5:658b:be39 with SMTP id 5614622812f47-3d5658bc079mr2930892b6e.38.1719461665890; Wed, 26 Jun 2024 21:14:25 -0700 (PDT) Received: from amd.. ([2804:7f0:b401:391e:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-72748e8539fsm273045a12.66.2024.06.26.21.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 21:14:25 -0700 (PDT) From: Gustavo Romero To: qemu-devel@nongnu.org, philmd@linaro.org, alex.bennee@linaro.org, richard.henderson@linaro.org Cc: peter.maydell@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v5 7/9] gdbstub: Make get cpu and hex conversion functions non-internal Date: Thu, 27 Jun 2024 04:13:47 +0000 Message-Id: <20240627041349.356704-8-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240627041349.356704-1-gustavo.romero@linaro.org> References: <20240627041349.356704-1-gustavo.romero@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=gustavo.romero@linaro.org; helo=mail-oi1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Make the gdb_first_attached_cpu and gdb_hextomem non-internal so they are not confined to use only in gdbstub.c. Signed-off-by: Gustavo Romero Reviewed-by: Richard Henderson --- gdbstub/internals.h | 2 -- include/exec/gdbstub.h | 5 +++++ include/gdbstub/commands.h | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 34121dc61a..81875abf5f 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -107,7 +107,6 @@ static inline int tohex(int v) void gdb_put_strbuf(void); int gdb_put_packet_binary(const char *buf, int len, bool dump); -void gdb_hextomem(GByteArray *mem, const char *buf, int len); void gdb_memtohex(GString *buf, const uint8_t *mem, int len); void gdb_memtox(GString *buf, const char *mem, int len); void gdb_read_byte(uint8_t ch); @@ -130,7 +129,6 @@ bool gdb_got_immediate_ack(void); /* utility helpers */ GDBProcess *gdb_get_process(uint32_t pid); CPUState *gdb_get_first_cpu_in_process(GDBProcess *process); -CPUState *gdb_first_attached_cpu(void); void gdb_append_thread_id(CPUState *cpu, GString *buf); int gdb_get_cpu_index(CPUState *cpu); unsigned int gdb_get_max_cpus(void); /* both */ diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 1bd2c4ec2a..77e5ec9a5b 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -135,4 +135,9 @@ void gdb_set_stop_cpu(CPUState *cpu); /* in gdbstub-xml.c, generated by scripts/feature_to_c.py */ extern const GDBFeature gdb_static_features[]; +/** + * Return the first attached CPU + */ +CPUState *gdb_first_attached_cpu(void); + #endif /* GDBSTUB_H */ diff --git a/include/gdbstub/commands.h b/include/gdbstub/commands.h index 2204c3ddbe..914b6d7313 100644 --- a/include/gdbstub/commands.h +++ b/include/gdbstub/commands.h @@ -93,4 +93,10 @@ void gdb_extend_set_table(GdbCmdParseEntry *table, int size); */ void gdb_extend_qsupported_features(char *qsupported_features); +/** + * Convert a hex string to bytes. Conversion is done per byte, so 2 hex digits + * are converted to 1 byte. Invalid hex digits are treated as 0 digits. + */ +void gdb_hextomem(GByteArray *mem, const char *buf, int len); + #endif /* GDBSTUB_COMMANDS_H */