This is the mail archive of the insight@sources.redhat.com mailing list for the Insight 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: Developing for Insight


On Tue, 2003-04-22 at 14:34, Liang, James wrote:
> I know it hits gdbtk_tcl_idle because I saw function calls with
> gdbtk_tcl_idle being sent to the Tcl/TK interpreter C code.
> 
> the "tk gdb_target_has_execution" returns 0

That could be a problem. Insight doesn't think that you have an
inferior. I presume that doing "tk set ::gdb_running" returns 0 as well.

> How do I access that flag in C code?

You need to have a ptid set and target_has_execution must be set. Goofy,
but that's what gdb does. Here's the function from
gdbtk/generic/gdbtk-cmds.c:

static int
gdb_target_has_execution_command (ClientData clientData, Tcl_Interp
*interp,
                                  int objc, Tcl_Obj *CONST objv[])
{
  int result = 0;

  if (target_has_execution && ! ptid_equal (inferior_ptid, null_ptid))
    result = 1;

  Tcl_SetBooleanObj (result_ptr->obj_ptr, result);
  return TCL_OK;
}

Normally, target's will set inferior_ptid in their "create_inferior"
target method. When there is no such thing as a pid/tid, we make one up.
remote-sim.c, for example, does this:

	inferior_ptid = pid_to_ptid (42);

Keith



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