|
From: openocd-gerrit <ope...@us...> - 2026-09-06 14:44:35
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 0c5906dc9d908264b2ce1159a9d421ccb48fdc57 (commit)
via f4745331f1acb93c270e3f430a874caacf6ed61a (commit)
via 47fa0fdbb4c9622c85c9a3002cfe892c8f7fc656 (commit)
from 942bd99c1ba4f436e9309b7f7ba25e190f29604e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0c5906dc9d908264b2ce1159a9d421ccb48fdc57
Author: Tomas Vanek <va...@fb...>
Date: Sat Aug 22 11:21:51 2026 +0200
target: free working area even if restore fails
The change was proposed by REVISIT comment since 2011
commit 813f4a5411af ("target: rewrite working area allocator")
Ensure target_free_working_area() works same way as
target_free_all_working_areas() does.
Change-Id: Ib92ad7b6b127e45417153ee35430990cb7f6b58c
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9864
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index f88689d5f..1b747f417 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2149,12 +2149,8 @@ static int target_free_working_area_restore(struct target *target, struct workin
return ERROR_OK;
int retval = ERROR_OK;
- if (restore) {
+ if (restore)
retval = target_restore_working_area(target, area);
- /* REVISIT: Perhaps the area should be freed even if restoring fails. */
- if (retval != ERROR_OK)
- return retval;
- }
area->free = true;
commit f4745331f1acb93c270e3f430a874caacf6ed61a
Author: Tomas Vanek <va...@fb...>
Date: Sat Aug 22 11:18:28 2026 +0200
target: recommend to reset target when work area restore fails
While on it restructure target_restore_working_area() code.
Change-Id: I4fcf18d8c673ec86443da527915cee3a383a7496
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9863
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index c91f47c63..f88689d5f 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2128,15 +2128,17 @@ int target_alloc_working_area(struct target *target, uint32_t size, struct worki
static int target_restore_working_area(struct target *target, struct working_area *area)
{
- int retval = ERROR_OK;
+ if (!target->backup_working_area || !area->backup)
+ return ERROR_OK;
- if (target->backup_working_area && area->backup) {
- retval = target_write_memory(target, area->address, 4, area->size / 4, area->backup);
- if (retval != ERROR_OK)
- LOG_ERROR("failed to restore %" PRIu32 " bytes of working area at address " TARGET_ADDR_FMT,
- area->size, area->address);
+ int retval = target_write_memory(target, area->address, 4,
+ area->size / 4, area->backup);
+ if (retval != ERROR_OK) {
+ LOG_TARGET_ERROR(target, "failed to restore %" PRIu32
+ " bytes of working area at address " TARGET_ADDR_FMT,
+ area->size, area->address);
+ LOG_TARGET_INFO(target, "'resume' would fail, reset the target");
}
-
return retval;
}
commit 47fa0fdbb4c9622c85c9a3002cfe892c8f7fc656
Author: Tomas Vanek <va...@fb...>
Date: Sat Aug 22 11:12:53 2026 +0200
target: log errors and clean up if work area backup fails
Call target_merge_working_areas() to clean up previously
split area.
Change-Id: I458e4331ed2f085d5349f4a6cd201ca95907ae3d
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9862
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index a5e967154..c91f47c63 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2088,13 +2088,19 @@ int target_alloc_working_area_try(struct target *target, uint32_t size, struct w
if (target->backup_working_area) {
if (!c->backup) {
c->backup = malloc(c->size);
- if (!c->backup)
+ if (!c->backup) {
+ LOG_TARGET_ERROR(target, "No memory for working area backup");
+ target_merge_working_areas(target);
return ERROR_FAIL;
+ }
}
int retval = target_read_memory(target, c->address, 4, c->size / 4, c->backup);
- if (retval != ERROR_OK)
+ if (retval != ERROR_OK) {
+ LOG_TARGET_ERROR(target, "Working area backup failed");
+ target_merge_working_areas(target);
return retval;
+ }
}
/* mark as used, and return the new (reused) area */
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|