This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] tracepoint.c: tfile_trace_find, make it return -1 when num is -1
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Hui Zhu <teawater at gmail dot com>
- Date: Thu, 19 May 2011 10:45:36 +0100
- Subject: Re: [RFA] tracepoint.c: tfile_trace_find, make it return -1 when num is -1
- References: <BANLkTimV9V+20hSz82Ov45P9S1Hf1yS1fA@mail.gmail.com>
On Thursday 19 May 2011 08:38:36, Hui Zhu wrote:
> Hi,
>
> I found that when GDB parse a tfile, tfile_trace_find will be call
> with num is -1 when GDB call target_read_live_memory.
> But it will not find anything. Because -1 is mean live frame.
>
> So I make a patch to make it return -1 when num is -1.
Set *tpp to -1 as well, see the end of the function. Something like:
/* No use looking up for frame -1 by number, it won't exist,
since -1 means live target/frame. */
if (type == tfind_number)
{
if (tpp)
*tpp = -1;
return -1;
}
Okay with that change.
>
> Thanks,
> Hui
>
> 2011-05-19 Hui Zhu <teawater@gmail.com>
>
> * tracepoint.c (tfile_trace_find): Return directly when num is -1.
> ---
> tracepoint.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> --- a/tracepoint.c
> +++ b/tracepoint.c
> @@ -3815,6 +3815,8 @@ tfile_trace_find (enum trace_find_type t
> first. */
> if (type != tfind_number)
> set_tfile_traceframe ();
> + else if (num == -1)
> + return -1;
>
> lseek (trace_fd, trace_frames_offset, SEEK_SET);
> offset = trace_frames_offset;
>
--
Pedro Alves