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]

Re: [PATCH] tracepoint: fix tfile byte order issue


On Tuesday 19 October 2010 09:48:28, Hui Zhu wrote:

> @@ -3665,6 +3665,9 @@ tfile_get_traceframe_address (off_t tfra
>     perror_with_name (trace_filename);
>   else if (gotten < 2)
>     error (_("Premature end of file while reading trace file"));
> +  tpnum = (short) extract_unsigned_integer ((gdb_byte *)&tpnum, 2,
> +                                           gdbarch_byte_order
> +                                               (get_current_arch ()));
> 
>   tp = get_tracepoint_by_number_on_target (tpnum);
>   /* FIXME this is a poor heuristic if multiple locations */
> @@ -3703,6 +3706,9 @@ tfile_trace_find (enum trace_find_type t
>        perror_with_name (trace_filename);
>       else if (gotten < 2)
>        error (_("Premature end of file while reading trace file"));
> +      tpnum = (short) extract_unsigned_integer ((gdb_byte *)&tpnum, 2,
> +                                               gdbarch_byte_order
> +                                                   (get_current_arch ()));

"The data in this section is raw binary, not a
hexadecimal or other encoding; its endianness matches the target's
endianness."

Please use target_gdbarch instead.

And use extract_signed_integer thus avoiding the casts.

-- 
Pedro Alves


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