libpdbg: Always fail sreset on p8

Message ID 20180606070213.30974-1-rashmica.g@gmail.com
State Accepted
Headers show
Series
  • libpdbg: Always fail sreset on p8
Related show

Commit Message

Rashmica Gupta June 6, 2018, 7:02 a.m.
Currently attempting to do a './pdbg -p x -c x -t x sreset'
segfaults as there is no sreset function defined for p8. Apparently
we can't easily sreset on p8, so add in function that always fails
as this is better than segfaulting.
---
 libpdbg/p8chip.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Alistair Popple June 15, 2018, 3:59 a.m. | #1
Thanks, not segfaulting is always a win. Looking at Skiboot it looks like Nick
may have figured out how to make it work so we should look into this some more
at some point. Failing that we can always emulate it using instruction ramming.

- Alistair

On Wednesday, 6 June 2018 5:02:13 PM AEST Rashmica Gupta wrote:
> Currently attempting to do a './pdbg -p x -c x -t x sreset'
> segfaults as there is no sreset function defined for p8. Apparently
> we can't easily sreset on p8, so add in function that always fails
> as this is better than segfaulting.
> ---
>  libpdbg/p8chip.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
> index 817ef2c..5e3ad97 100644
> --- a/libpdbg/p8chip.c
> +++ b/libpdbg/p8chip.c
> @@ -283,6 +283,12 @@ static int p8_thread_start(struct thread *thread)
>  	return 0;
>  }
>  
> +static int p8_thread_sreset(struct thread *thread)
> +{
> +	/* Broken on p8 */
> +	return 1;
> +}
> +
>  static int p8_ram_setup(struct thread *thread)
>  {
>  	struct pdbg_target *target;
> @@ -432,6 +438,7 @@ static struct thread p8_thread = {
>  	.step = p8_thread_step,
>  	.start = p8_thread_start,
>  	.stop = p8_thread_stop,
> +	.sreset = p8_thread_sreset,
>  	.ram_setup = p8_ram_setup,
>  	.ram_instruction = p8_ram_instruction,
>  	.ram_destroy = p8_ram_destroy,
>

Patch

diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 817ef2c..5e3ad97 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -283,6 +283,12 @@  static int p8_thread_start(struct thread *thread)
 	return 0;
 }
 
+static int p8_thread_sreset(struct thread *thread)
+{
+	/* Broken on p8 */
+	return 1;
+}
+
 static int p8_ram_setup(struct thread *thread)
 {
 	struct pdbg_target *target;
@@ -432,6 +438,7 @@  static struct thread p8_thread = {
 	.step = p8_thread_step,
 	.start = p8_thread_start,
 	.stop = p8_thread_stop,
+	.sreset = p8_thread_sreset,
 	.ram_setup = p8_ram_setup,
 	.ram_instruction = p8_ram_instruction,
 	.ram_destroy = p8_ram_destroy,