[Pdbg] [PATCH 04/14] pdbg: release targets on error, start, sreset, and probe
Alistair Popple
alistair at popple.id.au
Thu Apr 12 14:18:28 AEST 2018
It looks like we could call the release just prior to exiting main(). Do you
think there would be any problem doing it then?
- Alistair
On Monday, 9 April 2018 5:35:12 PM AEST Nicholas Piggin wrote:
> Special wakeup needs to remain asserted e.g., between stopping a
> thread and reading registers, but it should not remain raised
> indefinitely.
>
> This patch is not very satisfying, and a bit hacky. For now it's
> a tiny bit better than what we have.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> src/main.c | 9 +++++++--
> src/thread.c | 16 ++++++++++++++--
> 2 files changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/src/main.c b/src/main.c
> index 121e4ad..3f026f8 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -456,6 +456,9 @@ static int handle_probe(int optind, int argc, char *argv[])
>
> printf("\nNote that only selected targets will be shown above. If none are shown\n"
> "try adding '-a' to select all targets\n");
> +
> + pdbg_target_release();
> +
> return 1;
> }
>
> @@ -503,14 +506,16 @@ int main(int argc, char *argv[])
> }
>
> if (i == ARRAY_SIZE(actions)) {
> + pdbg_target_release();
> PR_ERROR("Unsupported command: %s\n", argv[optind]);
> print_usage(argv[0]);
> return 1;
> }
>
> if (rc <= 0) {
> - printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n");
> - printf("Alternatively run %s -a probe to get a list of all valid targets\n", argv[0]);
> + pdbg_target_release();
> + printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n");
> + printf("Alternatively run %s -a probe to get a list of all valid targets\n", argv[0]);
> rc = 1;
> } else
> rc = 0;
> diff --git a/src/thread.c b/src/thread.c
> index 03e5212..6001bb3 100644
> --- a/src/thread.c
> +++ b/src/thread.c
> @@ -104,7 +104,13 @@ static int sreset_thread(struct pdbg_target *thread_target, uint32_t index, uint
>
> int thread_start(int optind, int argc, char *argv[])
> {
> - return for_each_target("thread", start_thread, NULL, NULL);
> + int err;
> +
> + err = for_each_target("thread", start_thread, NULL, NULL);
> +
> + pdbg_target_release();
> +
> + return err;
> }
>
> int thread_step(int optind, int argc, char *argv[])
> @@ -140,5 +146,11 @@ int thread_status_print(int optind, int argc, char *argv[])
>
> int thread_sreset(int optind, int argc, char *argv[])
> {
> - return for_each_target("thread", sreset_thread, NULL, NULL);
> + int err;
> +
> + err = for_each_target("thread", sreset_thread, NULL, NULL);
> +
> + pdbg_target_release();
> +
> + return err;
> }
>
More information about the Pdbg
mailing list