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

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Nov 11 19:09:53 AEDT 2015


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.




More information about the Linuxppc-dev mailing list