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 v3 03/15] Read CTF by the ctf target


Yao Qi writes:
 > 2013-03-26  Hui Zhu  <hui@codesourcery.com>
 > 	    Yao Qi  <yao@codesourcery.com>
 > 
 > 	* configure.ac: Check libbabeltrace is installed.
 > 	* config.in: Regenerate.
 > 	* configure: Regenerate.
 > 	* Makefile.in (LIBBABELTRACE): New.
 > 	(CLIBS): Add LIBBABELTRACE.
 > 	* ctf.c (ctx, ctf_iter, trace_dirname): New.
 > 	(ctf_destroy, ctf_open_dir, ctf_open): New.
 > 	(ctf_close, ctf_files_info): New.
 > 	(ctf_fetch_registers, ctf_xfer_partial): New.
 > 	(ctf_get_trace_state_variable_value): New.
 > 	(ctf_get_tpnum_from_frame_event): New.
 > 	(ctf_get_traceframe_address): New.
 > 	(ctf_trace_find, ctf_has_stack): New.
 > 	(ctf_has_registers, ctf_traceframe_info, init_ctf_ops): New.
 > 	(_initialize_ctf): New.
 > 	* tracepoint.c (get_tracepoint_number): New
 >  	(struct traceframe_info, trace_regblock_size): Move it to ...
 > 	* tracepoint.h: ... here.
 > 	(get_tracepoint_number): Declare it.
 > [...]
 > +/* Return the address at which the current frame was collected.  */
 > +
 > +static ULONGEST
 > +ctf_get_traceframe_address (void)
 > +{
 > +  struct bt_ctf_event *event = NULL;
 > +  struct bt_iter_pos *pos;
 > +  ULONGEST addr = 0;
 > +
 > +  gdb_assert (ctf_iter != NULL);
 > +  pos  = bt_iter_get_pos (bt_ctf_get_iter (ctf_iter));
 > +  gdb_assert (pos->type == BT_SEEK_RESTORE);
 > +
 > +  while (1)
 > +    {
 > +      const char *name;
 > +      struct bt_ctf_event *event1;
 > +
 > +      event1 = bt_ctf_iter_read_event (ctf_iter);
 > +
 > +      name = bt_ctf_event_name (event1);
 > +
 > +      if (name == NULL)
 > +	break;
 > +      else if (strcmp (name, "frame") == 0)
 > +	{
 > +	  event = event1;
 > +	  break;
 > +	}
 > +
 > +      if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
 > +	break;
 > +    }
 > +
 > +  if (event != NULL)
 > +    {
 > +      int tpnum = ctf_get_tpnum_from_frame_event (event);
 > +      struct tracepoint *tp
 > +	= get_tracepoint_by_number_on_target (tpnum);
 > +
 > +      if (tp && tp->base.loc)
 > +	addr = tp->base.loc->address;
 > +    }
 > +
 > +  /* Restore the position.  */
 > +  bt_iter_set_pos (bt_ctf_get_iter (ctf_iter), pos);
 > +
 > +  return addr;
 > +}

One last thing.  Apologies for not bringing this up earlier.

I'm not sure we have any conventions explicitly saying to use CORE_ADDR
instead of {,U}LONGEST for addresses, but tp->base.loc->address is a CORE_ADDR.
It feels like everywhere you're using ULONGEST for addresses you need to
use CORE_ADDR instead.

Or maybe there's a specific reason to use ULONGEST?


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