This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: [RFC] Add support of software single step to process record


---------- Forwarded message ----------
From: shuchang zhou <shuchang.zhou@gmail.com>
Date: Thu, Dec 24, 2009 at 9:51 AM
Subject: Re: [RFC] Add support of software single step to process record
To: Hui Zhu <teawater@gmail.com>
Cc: gdb-patches@sourceware.org, msnyder@vmware.com


Still get errors. Current patch is in attachment (I just integrated
the patch you sent me with mine, basically dropping my version of
linux-mips-tdep.c).

(gdb) b main
Breakpoint 1 at 0x400730: file t.c, line 17.
(gdb) set debug infrun 1
(gdb) set debug record 1
(gdb) r
Starting program: /root/tmpd/a.out
infrun: proceed (addr=0xffffffff, signal=0, step=0)
infrun: resume (step=0, signal=0), trap_expected=0
infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
infrun: target_wait (-1, status) =
infrun:?? 12655 [process 12655],
infrun:?? status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x2aaba7c0
infrun: BPSTAT_WHAT_CHECK_SHLIBS
infrun: no stepping, continue
infrun: resume (step=1, signal=0), trap_expected=1
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:?? 12655 [process 12655],
infrun:?? status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x2aaab620
infrun: software single step trap for process 12655
infrun: no stepping, continue
infrun: resume (step=0, signal=0), trap_expected=0
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:?? 12655 [process 12655],
infrun:?? status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x2aaba7c0
infrun: BPSTAT_WHAT_CHECK_SHLIBS
infrun: no stepping, continue
infrun: resume (step=1, signal=0), trap_expected=1
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:?? 12655 [process 12655],
infrun:?? status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x2aaabff0
infrun: software single step trap for process 12655
infrun: no stepping, continue
infrun: resume (step=0, signal=0), trap_expected=0
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:?? 12655 [process 12655],
infrun:?? status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x400730
infrun: BPSTAT_WHAT_STOP_NOISY
infrun: stop_stepping

Breakpoint 1, main () at t.c:17
17??? ? xyz = 0;????? /* break in main */
(gdb) record
Process record: record_open
Process record: record_open
(gdb) n
infrun: clear_proceed_status_thread (process 12655)
infrun: proceed (addr=0xffffffff, signal=144, step=1)
infrun: resume (step=1, signal=0), trap_expected=1
record: mips_record_32 insn = 0x8f828034
main () at t.c:17
17??? ? xyz = 0;????? /* break in main */
ptrace: Input/output error.
(gdb)
(gdb) quit
A debugging session is active.

??? Inferior 1 [process 12655] will be killed.

Quit anyway? (y or n) y
Process record: record_kill
Process record: record_close

And then it hangs the terminal.

On Wed, Dec 23, 2009 at 5:23 PM, Hui Zhu <teawater@gmail.com> wrote:
>
> Cool. ?I think your idea is more better than I did. ?Thanks.
>
> This is the new patch.
>
> Best regards,
> Hui
>
> On Wed, Dec 23, 2009 at 14:51, Joel Brobecker <brobecker@adacore.com> wrote:
> >> Joel, I remove the current_gdbarch() from this patch, but for
> >> get_current_frame, I cannot find any function that fit for replace it.
> >> ?Could you help me with it?
> >
> > Upon further investigation, I believe that this is the only way to do
> > this. ?I don't think you can get the frame from the arguments provided
> > to "resume". I did a quick research and infrun.c:resume does the same
> > thing (actually, it's maybe_software_singlestep).
> >
> >> + ?if (single_step_breakpoints[0] != NULL
> >> + ? ? ?|| single_step_breakpoints[1] != NULL)
> >> + ? ?return 1;
> >> +
> >> + ?return 0;
> >
> > Style nit: You really don't have to fix this, as this is a matter of
> > style more than correctness, but we usually write the above code as
> >
> > ?return (single_step_breakpoints[0] != NULL
> > ? ? ? ? ?|| single_step_breakpoints[1] != NULL)
> >
> > This avoids the type of mistake you made. ?I tend to like the style
> > you used when there are several consecutive if conditions that allow
> > me to return early (a type of soft assert), or to avoid unreasonable
> > nesting levels.
> >
> > --
> > Joel
> >

Attachment: gdb3.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]