예제 #1
0
파일: tui-data.c 프로젝트: ChrisG0x20/gdb
void
tui_free_window (struct tui_win_info *win_info)
{
  struct tui_gen_win_info *generic_win;

  switch (win_info->generic.type)
    {
    case SRC_WIN:
    case DISASSEM_WIN:
      if (win_info->detail.source_info.fullname)
        {
          xfree (win_info->detail.source_info.fullname);
          win_info->detail.source_info.fullname = NULL;
        }
      generic_win = win_info->detail.source_info.execution_info;
      if (generic_win != (struct tui_gen_win_info *) NULL)
	{
	  tui_delete_win (generic_win->handle);
	  generic_win->handle = NULL;
	  tui_free_win_content (generic_win);
	}
      break;
    case DATA_WIN:
      if (win_info->generic.content != NULL)
	{
	  tui_free_data_content (win_info->detail.data_display_info.regs_content,
				 win_info->detail.data_display_info.regs_content_count);
	  win_info->detail.data_display_info.regs_content =
	    (tui_win_content) NULL;
	  win_info->detail.data_display_info.regs_content_count = 0;
	  tui_free_data_content (win_info->detail.data_display_info.data_content,
				 win_info->detail.data_display_info.data_content_count);
	  win_info->detail.data_display_info.data_content =
	    (tui_win_content) NULL;
	  win_info->detail.data_display_info.data_content_count = 0;
	  win_info->detail.data_display_info.regs_column_count = 1;
	  win_info->detail.data_display_info.display_regs = FALSE;
	  win_info->generic.content = NULL;
	  win_info->generic.content_size = 0;
	}
      break;
    default:
      break;
    }
  if (win_info->generic.handle != (WINDOW *) NULL)
    {
      tui_delete_win (win_info->generic.handle);
      win_info->generic.handle = NULL;
      tui_free_win_content (&win_info->generic);
    }
  if (win_info->generic.title)
    xfree (win_info->generic.title);
  xfree (win_info);
}
예제 #2
0
파일: tui-data.c 프로젝트: ChrisG0x20/gdb
/* Delete all curses windows associated with win_info, leaving
   everything else intact.  */
void
tui_del_window (struct tui_win_info *win_info)
{
  struct tui_gen_win_info *generic_win;

  switch (win_info->generic.type)
    {
    case SRC_WIN:
    case DISASSEM_WIN:
      generic_win = tui_locator_win_info_ptr ();
      if (generic_win != (struct tui_gen_win_info *) NULL)
	{
	  tui_delete_win (generic_win->handle);
	  generic_win->handle = NULL;
	  generic_win->is_visible = FALSE;
	}
      if (win_info->detail.source_info.fullname)
        {
          xfree (win_info->detail.source_info.fullname);
          win_info->detail.source_info.fullname = NULL;
        }
      generic_win = win_info->detail.source_info.execution_info;
      if (generic_win != (struct tui_gen_win_info *) NULL)
	{
	  tui_delete_win (generic_win->handle);
	  generic_win->handle = NULL;
	  generic_win->is_visible = FALSE;
	}
      break;
    case DATA_WIN:
      if (win_info->generic.content != NULL)
	{
	  tui_del_data_windows (win_info->detail.data_display_info.regs_content,
				win_info->detail.data_display_info.regs_content_count);
	  tui_del_data_windows (win_info->detail.data_display_info.data_content,
				win_info->detail.data_display_info.data_content_count);
	}
      break;
    default:
      break;
    }
  if (win_info->generic.handle != (WINDOW *) NULL)
    {
      tui_delete_win (win_info->generic.handle);
      win_info->generic.handle = NULL;
      win_info->generic.is_visible = FALSE;
    }
}
예제 #3
0
파일: tui-data.c 프로젝트: ChrisG0x20/gdb
void
tui_free_data_content (tui_win_content content, 
		       int content_size)
{
  int i;

  /* Remember that data window content elements are of type struct
     tui_gen_win_info *, each of which whose single element is a data
     element.  */
  for (i = 0; i < content_size; i++)
    {
      struct tui_gen_win_info *generic_win
	= &content[i]->which_element.data_window;

      if (generic_win != (struct tui_gen_win_info *) NULL)
	{
	  tui_delete_win (generic_win->handle);
	  generic_win->handle = NULL;
	  tui_free_win_content (generic_win);
	}
    }
  free_content (content,
		content_size,
		DATA_WIN);
}
예제 #4
0
/* We can't really make windows visible, or invisible.  So we have to
   delete the entire window when making it visible, and create it
   again when making it visible.  */
static void
make_visible (struct tui_gen_win_info *win_info, int visible)
{
  /* Don't tear down/recreate command window */
  if (win_info->type == CMD_WIN)
    return;

  if (visible)
    {
      if (!win_info->is_visible)
	{
	  tui_make_window (win_info,
			   (win_info->type != CMD_WIN
			    && !tui_win_is_auxillary (win_info->type)));
	  win_info->is_visible = TRUE;
	}
    }
  else if (!visible &&
	   win_info->is_visible && win_info->handle != (WINDOW *) NULL)
    {
      win_info->is_visible = FALSE;
      tui_delete_win (win_info->handle);
      win_info->handle = (WINDOW *) NULL;
    }

  return;
}
예제 #5
0
void
tui_del_data_windows (tui_win_content content, int content_size)
{
  int i;

  /*
     ** Remember that data window content elements are of type struct tui_gen_win_info *,
     ** each of which whose single element is a data element.
   */
  for (i = 0; i < content_size; i++)
    {
      struct tui_gen_win_info * generic_win = &content[i]->which_element.data_window;

      if (generic_win != (struct tui_gen_win_info *) NULL)
	{
	  tui_delete_win (generic_win->handle);
	  generic_win->handle = (WINDOW *) NULL;
	  generic_win->is_visible = FALSE;
	}
    }
}
예제 #6
0
/* Function to display the registers in the content from
   'start_element_no' until the end of the register content or the end
   of the display height.  No checking for displaying past the end of
   the registers is done here.  */
void
tui_display_registers_from (int start_element_no)
{
    struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info;

    if (display_info->regs_content != (tui_win_content) NULL
            && display_info->regs_content_count > 0)
    {
        int i = start_element_no;
        int j, item_win_width, cur_y;

        int max_len = 0;
        for (i = 0; i < display_info->regs_content_count; i++)
        {
            struct tui_data_element *data;
            struct tui_gen_win_info *data_item_win;
            char *p;
            int len;

            data_item_win
                = &display_info->regs_content[i]->which_element.data_window;
            data = &((struct tui_win_element *)
                     data_item_win->content[0])->which_element.data;
            len = 0;
            p = data->content;
            if (p != 0)
                while (*p)
                {
                    if (*p++ == '\t')
                        len = 8 * ((len / 8) + 1);
                    else
                        len++;
                }

            if (len > max_len)
                max_len = len;
        }
        item_win_width = max_len + 1;
        i = start_element_no;

        display_info->regs_column_count =
            (TUI_DATA_WIN->generic.width - 2) / item_win_width;
        if (display_info->regs_column_count == 0)
            display_info->regs_column_count = 1;
        item_win_width =
            (TUI_DATA_WIN->generic.width - 2) / display_info->regs_column_count;

        /* Now create each data "sub" window, and write the display into
        it.  */
        cur_y = 1;
        while (i < display_info->regs_content_count
                && cur_y <= TUI_DATA_WIN->generic.viewport_height)
        {
            for (j = 0;
                    j < display_info->regs_column_count
                    && i < display_info->regs_content_count;
                    j++)
            {
                struct tui_gen_win_info *data_item_win;
                struct tui_data_element *data_element_ptr;

                /* Create the window if necessary.  */
                data_item_win = &display_info->regs_content[i]
                                ->which_element.data_window;
                data_element_ptr = &((struct tui_win_element *)
                                     data_item_win->content[0])->which_element.data;
                if (data_item_win->handle != (WINDOW*) NULL
                        && (data_item_win->height != 1
                            || data_item_win->width != item_win_width
                            || data_item_win->origin.x != (item_win_width * j) + 1
                            || data_item_win->origin.y != cur_y))
                {
                    tui_delete_win (data_item_win->handle);
                    data_item_win->handle = 0;
                }

                if (data_item_win->handle == (WINDOW *) NULL)
                {
                    data_item_win->height = 1;
                    data_item_win->width = item_win_width;
                    data_item_win->origin.x = (item_win_width * j) + 1;
                    data_item_win->origin.y = cur_y;
                    tui_make_window (data_item_win, DONT_BOX_WINDOW);
                    scrollok (data_item_win->handle, FALSE);
                }
                touchwin (data_item_win->handle);

                /* Get the printable representation of the register
                       and display it.  */
                tui_display_register (data_element_ptr, data_item_win);
                i++;		/* Next register.  */
            }
            cur_y++;		/* Next row.  */
        }
    }
}