Subject: Re: [xmon PATCH 1/1] RFC: Add xmon command to dump process/task similar to ps(1)

From: Benjamin Herrenschmidt <[email-masked]>
Date: Wed, 11 Nov 2015 19:09:53 +1100

On Tue, 2015-11-10 at 10:50 -0600, Douglas Miller wrote:
> +{
> +	unsigned long tskv;
> +	struct task_struct *tsk;
> +
> +	if (scanhex(&tskv)) {
> +		procshow((struct task_struct *)tskv);
> +	} else {
> +		for_each_process(tsk) {
> +			procshow(tsk);
> +		}
> +	}
> +}
> +

The main thing is wrap it with the setjump magic that xmon uses for
other things that allows it to recover if you hit a bad pointer
along the way:

	if (setjmp(bus_error_jmp) == 0) {
		catch_memory_errors = 1;
		sync();
		... do your stuff...
		sync();
	}
	catch_memory_errors = 0;

We could make some kind of helper or macro to factor that out
while it it ;-) (For bonus points !)

Cheers,
Ben.