Exemple #1
0
/** Print where we are in the Makefile. */
void 
print_debugger_location(const file_t *p_target, debug_enter_reason_t reason,
			const floc_stack_node_t *p_stack_floc)
{
  if (p_target_loc) {
    if (reason != DEBUG_NOT_GIVEN && reason != DEBUG_STACK_CHANGING)
      printf("%s ", reason2str[reason]);
    printf("(");
    if ( !p_target_loc->filenm && p_target_loc->lineno != 0 
	 && p_target && p_target->name ) {
      /* We don't have file location info in the target floc, but we
	 do have it as part of the name, so use that. This happens for
	 example with we've stopped before reading a Makefile.
      */
      if (p_target->cmds) {
	floc_t floc;
	memcpy(&floc, &(p_target->cmds->fileinfo.filenm), sizeof(floc_t));
	/* HACK: is it okay to assume that the target is on the line
	   before the first command? Or should we list the line
	   that the command starts on - so we know we've faked the location?
	*/
	floc.lineno--;
	p_target_loc->filenm = floc.filenm;
	p_target_loc->lineno = floc.lineno;
	print_floc_prefix(&floc);
	printf (")\n");
      } else if (p_target->phony)
	printf("%s: .PHONY target)\n", p_target->name);
      else 
	printf("%s:0)\n", p_target->name);
    } else {
      print_floc_prefix(p_target_loc);
      printf (")\n");
    }
  } else if (p_stack_floc && p_stack_floc->p_floc) {
      printf("\n(");
      print_floc_prefix(p_stack_floc->p_floc);
      printf (")\n");
  } else if (p_stack_floc_top && p_stack_floc_top->p_floc) {
      printf("\n(");
      print_floc_prefix(p_stack_floc_top->p_floc);
      printf (")\n");
  }

  /* Could/should generalize the below into a prompt string. */
  switch (reason) 
    {
    case DEBUG_BRKPT_BEFORE_PREREQ:
    case DEBUG_STEP_HIT:
      dbg_cmd_show_exp("$@: $+", true);
      break;
    case DEBUG_STACK_CHANGING:
      break;
    default:
      dbg_cmd_show_exp("$@", true);
      break;
    }
}
Exemple #2
0
/*! List breakpoints.*/
void
list_breakpoints (void)
{
  breakpoint_node_t *p;

  if (!p_breakpoint_top) {
    dbg_msg(_("No breakpoints."));
    return;
  }

  dbg_msg(  "Num Type           Disp Enb Mask Target  Location");
  for (p = p_breakpoint_top; p; p = p->p_next) {
    printf("%3d breakpoint     keep   y 0x%02x %s",
	   p->i_num,
	   p->brkpt_mask,
           p->p_target->name);
    if (p->p_target->floc.filenm) {
	printf(" at ");
	print_floc_prefix(&(p->p_target->floc));
    }
    printf("\n");
  }
}