[Pdbg] [PATCH v2 06/10] thread.c: threadstatus improve output and implement P9 stop

Joel Stanley joel at jms.id.au
Wed May 2 02:41:46 AEST 2018


On 2 May 2018 at 02:03, Nicholas Piggin <npiggin at gmail.com> wrote:
> There's no point compressing status down to a single letter. Add
> letters for each mode we are intereted in. Add the P9 stop state.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>  src/thread.c | 102 +++++++++++++++++++++++++++++++--------------------
>  1 file changed, 63 insertions(+), 39 deletions(-)
>
> diff --git a/src/thread.c b/src/thread.c
> index a5fff33..67ce281 100644
> --- a/src/thread.c
> +++ b/src/thread.c
> @@ -27,60 +27,84 @@
>
>  static int print_thread_status(struct pdbg_target *target, uint32_t index, uint64_t *status, uint64_t *unused1)
>  {
> -       *status = SETFIELD(0xffULL << (index * 8), *status, thread_status(target) & 0xffULL);
> +       status[index] = thread_status(target);
>         return 1;
>  }
>
> -static int print_core_thread_status(struct pdbg_target *core_target, uint32_t index, uint64_t *unused, uint64_t *unused1)
> +static int print_core_thread_status(struct pdbg_target *core_target, uint32_t index, uint64_t *maxindex, uint64_t *unused1)
>  {

> +
> +       printf("c%02d: ", index);
> +       rc = for_each_child_target("thread", core_target, print_thread_status, &status[0], NULL);
> +       for (i = 0; i <= *maxindex; i++) {
> +               if (status[i] == -1ULL) {
> +                       printf("    ");
> +                       continue;
> +               }
> +               if (status[i] & ~(THREAD_STATUS_ACTIVE|THREAD_STATUS_DOZE|
> +                                 THREAD_STATUS_NAP|THREAD_STATUS_SLEEP|
> +                                 THREAD_STATUS_STOP|THREAD_STATUS_QUIESCE)) {
> +                       printf("%llx ", status[i]);

Try this:

  printf("%"PRIx64" ", status[i]);

Otherwise ppc64 breaks on my tests:

./configure --host=powerpc64le-linux-gnu
make
  CC       src/pdbg-thread.o
src/thread.c: In function ‘print_core_thread_status’:
src/thread.c:51:15: error: format ‘%llx’ expects argument of type
‘long long unsigned int’, but argument 2 has type ‘uint64_t {aka long
unsigned int}’ [-Werror=format=]
    printf("%llx ", status[i]);
            ~~~^    ~~~~~~~~~
            %lx

Cheers,

Joel


More information about the Pdbg mailing list