Bug 11253 - SEGV during reverse debugging w/ record target over simulator
Summary: SEGV during reverse debugging w/ record target over simulator
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.0
: P1 critical
Target Milestone: 7.1
Assignee: teawater
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-05 02:37 UTC by Anthony Green
Modified: 2010-03-11 09:24 UTC (History)
3 users (show)

See Also:
Host:
Target: moxie-elf
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Green 2010-02-05 02:37:23 UTC
I'm getting a SEGV now whenever I step after setting record on for my target
(the built-in moxie simulator).

It's happening in the first line of watchpoints_triggered(), where the code reads:
 int stopped_by_watchpoint = target_stopped_by_watchpoint ();

target_stopped_by_watchpoint is defined as
(*current_target.to_stopped_by_watchpoint).

The problem is that current_target.to_stopped_by_watchpoint is NULL.

This has something to do with how the record and simulator targets interact.

Normal breakpoints (w/o record) are working fine.

AG
Comment 1 teawater 2010-02-05 06:41:07 UTC
Thanks Anthony.

Hello everybody,

Now I have 2 ways to handle this issue:
1. Add a check to record.c when it call to_stopped_by_watchpoint
2. Add a default value for to_stopped_by_watchpoint to init_dummy_target.

Which way for us it better?

Thanks,
Hui
Comment 2 Anthony Green 2010-02-05 13:03:19 UTC
(In reply to comment #1)
> Thanks Anthony.
> 
> Hello everybody,
> 
> Now I have 2 ways to handle this issue:
> 1. Add a check to record.c when it call to_stopped_by_watchpoint
> 2. Add a default value for to_stopped_by_watchpoint to init_dummy_target.
> 
> Which way for us it better?

My guess is [2].

Thanks!

AG
Comment 3 teawater 2010-02-08 05:45:14 UTC
Subject: Re:  SEGV during reverse debugging w/ record target 
	over simulator

Hi Anthony,

I make a patch for it.

Please help me test it.

Thanks,
Hui

2010-02-08  Hui Zhu  <teawater@gmail.com>

	* target.c (init_dummy_target): Add to_stopped_by_watchpoint.
---
 target.c |    1 +
 1 file changed, 1 insertion(+)

--- a/target.c
+++ b/target.c
@@ -2836,6 +2836,7 @@ init_dummy_target (void)
   dummy_target.to_has_stack = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_execution = (int (*) (struct target_ops *)) return_zero;
+  dummy_target.to_stopped_by_watchpoint = return_zero;
   dummy_target.to_magic = OPS_MAGIC;
 }
Comment 4 teawater 2010-02-20 05:56:24 UTC
Subject: Re:  SEGV during reverse debugging w/ record target 
	over simulator

Ping.

On Mon, Feb 8, 2010 at 13:44, Hui Zhu <teawater@gmail.com> wrote:
> Hi Anthony,
>
> I make a patch for it.
>
> Please help me test it.
>
> Thanks,
> Hui
>
> 2010-02-08  Hui Zhu  <teawater@gmail.com>
>
>        * target.c (init_dummy_target): Add to_stopped_by_watchpoint.
> ---
>  target.c |    1 +
>  1 file changed, 1 insertion(+)
>
> --- a/target.c
> +++ b/target.c
> @@ -2836,6 +2836,7 @@ init_dummy_target (void)
>   dummy_target.to_has_stack = (int (*) (struct target_ops *)) return_zero;
>   dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero;
>   dummy_target.to_has_execution = (int (*) (struct target_ops *)) return_zero;
> +  dummy_target.to_stopped_by_watchpoint = return_zero;
>   dummy_target.to_magic = OPS_MAGIC;
>  }
>
Comment 5 Pedro Alves 2010-02-22 13:04:23 UTC
Subject: Re:  SEGV during reverse debugging w/ record target 
 =?iso-8859-1?q?=09over?= simulator

On Saturday 20 February 2010 05:55:57, Hui Zhu wrote:
> Ping.
> 
> On Mon, Feb 8, 2010 at 13:44, Hui Zhu <teawater@gmail.com> wrote:
> > Hi Anthony,
> >
> > I make a patch for it.
> >
> > Please help me test it.
> >
> > Thanks,
> > Hui
> >
> > 2010-02-08  Hui Zhu  <teawater@gmail.com>
> >
> >        * target.c (init_dummy_target): Add to_stopped_by_watchpoint.
> > ---
> >  target.c |    1 +
> >  1 file changed, 1 insertion(+)
> >
> > --- a/target.c
> > +++ b/target.c
> > @@ -2836,6 +2836,7 @@ init_dummy_target (void)
> >   dummy_target.to_has_stack = (int (*) (struct target_ops *)) return_zero;
> >   dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero;
> >   dummy_target.to_has_execution = (int (*) (struct target_ops *)) return_zero;
> > +  dummy_target.to_stopped_by_watchpoint = return_zero;
> >   dummy_target.to_magic = OPS_MAGIC;
> >  }
> >
> 

Does this actually fix the problem?  How?

Comment 6 teawater 2010-02-22 16:47:41 UTC
Patch wait Green's test.
Comment 7 Anthony Green 2010-02-25 21:44:35 UTC
(In reply to comment #3)
> Subject: Re:  SEGV during reverse debugging w/ record target 
> 	over simulator
> 
> Hi Anthony,
> 
> I make a patch for it.
> 
> Please help me test it.
> 

This patch appears to fix the problem.

Thanks!

AG
Comment 8 teawater 2010-02-26 03:26:19 UTC
Wait review.
Comment 9 teawater 2010-03-11 09:24:59 UTC
Fixed in cvs-head.