当前位置: 首页>>代码示例>>C++>>正文


C++ current_inferior函数代码示例

本文整理汇总了C++中current_inferior函数的典型用法代码示例。如果您正苦于以下问题:C++ current_inferior函数的具体用法?C++ current_inferior怎么用?C++ current_inferior使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了current_inferior函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add_to_thread_list

static void
add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
{
  ptid_t ptid;
  int core_tid;
  int pid, lwpid;
  asection *reg_sect = (asection *) reg_sect_arg;

  if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
    return;

  core_tid = atoi (bfd_section_name (abfd, asect) + 5);

  pid = bfd_core_file_pid (core_bfd);
  if (pid == 0)
    {
      core_has_fake_pid = 1;
      pid = CORELOW_PID;
    }

  lwpid = core_tid;

  if (current_inferior ()->pid == 0)
    inferior_appeared (current_inferior (), pid);

  ptid = ptid_build (pid, lwpid, 0);

  add_thread (ptid);

/* Warning, Will Robinson, looking at BFD private data! */

  if (reg_sect != NULL
      && asect->filepos == reg_sect->filepos)	/* Did we find .reg?  */
    inferior_ptid = ptid;			/* Yes, make it current.  */
}
开发者ID:CyberGrandChallenge,项目名称:gdb,代码行数:35,代码来源:corelow.c

示例2: info_mach_exceptions_command

static void
info_mach_exceptions_command (const char *args, int from_tty)
{
  int i;
  task_t task;
  kern_return_t kret;
  darwin_exception_info info;

  info.count = sizeof (info.ports) / sizeof (info.ports[0]);

  if (args != NULL)
    {
      if (strcmp (args, "saved") == 0)
	{
	  if (ptid_equal (inferior_ptid, null_ptid))
	    printf_unfiltered (_("No inferior running\n"));

	  darwin_inferior *priv = get_darwin_inferior (current_inferior ());

	  disp_exception (&priv->exception_info);
	  return;
	}
      else if (strcmp (args, "host") == 0)
	{
	  /* FIXME: This need a privilegied host port!  */
	  kret = host_get_exception_ports
	    (darwin_host_self, EXC_MASK_ALL, info.masks,
	     &info.count, info.ports, info.behaviors, info.flavors);
	  MACH_CHECK_ERROR (kret);
	  disp_exception (&info);
	}
      else
	error (_("Parameter is saved, host or none"));
    }
  else
    {
      struct inferior *inf;

      if (ptid_equal (inferior_ptid, null_ptid))
	printf_unfiltered (_("No inferior running\n"));
      inf = current_inferior ();
      
      darwin_inferior *priv = get_darwin_inferior (inf);

      kret = task_get_exception_ports
	(priv->task, EXC_MASK_ALL, info.masks,
	 &info.count, info.ports, info.behaviors, info.flavors);
      MACH_CHECK_ERROR (kret);
      disp_exception (&info);
    }
}
开发者ID:sifive,项目名称:riscv-binutils-gdb,代码行数:51,代码来源:darwin-nat-info.c

示例3: memory_xfer_auxv

LONGEST
memory_xfer_auxv (struct target_ops *ops,
		  enum target_object object,
		  const char *annex,
		  gdb_byte *readbuf,
		  const gdb_byte *writebuf,
		  ULONGEST offset,
		  LONGEST len)
{
  gdb_assert (object == TARGET_OBJECT_AUXV);
  gdb_assert (readbuf || writebuf);

   /* ld_so_xfer_auxv is the only function safe for virtual
      executables being executed by valgrind's memcheck.  Using
      ld_so_xfer_auxv during inferior startup is problematic, because
      ld.so symbol tables have not yet been relocated.  So GDB uses
      this function only when attaching to a process.
      */

  if (current_inferior ()->attach_flag != 0)
    {
      LONGEST retval;

      retval = ld_so_xfer_auxv (readbuf, writebuf, offset, len);
      if (retval != -1)
	return retval;
    }

  return procfs_xfer_auxv (readbuf, writebuf, offset, len);
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:30,代码来源:auxv.c

示例4: spu_skip_standalone_loader

/* When running a stand-alone SPE executable, we may need to skip one more
   exec event on startup, to get past the binfmt_misc loader.  */
static void
spu_skip_standalone_loader (void)
{
  if (target_has_execution && !current_inferior ()->attach_flag)
    {
      struct target_waitstatus ws;

      /* Only some kernels report an extra SIGTRAP with the binfmt_misc
	 loader; others do not.  In addition, if we have attached to an
	 already running inferior instead of starting a new one, we will
	 not see the extra SIGTRAP -- and we cannot readily distinguish
	 the two cases, in particular with the extended-remote target.

	 Thus we issue a single-step here.  If no extra SIGTRAP was pending,
	 this will step past the first instruction of the stand-alone SPE
	 executable loader, but we don't care about that.  */

      inferior_thread ()->control.in_infcall = 1; /* Suppress MI messages.  */

      target_resume (inferior_ptid, 1, GDB_SIGNAL_0);
      target_wait (minus_one_ptid, &ws, 0);
      set_executing (minus_one_ptid, 0);

      inferior_thread ()->control.in_infcall = 0;
    }
}
开发者ID:Bracksun,项目名称:binutils-gdb,代码行数:28,代码来源:solib-spu.c

示例5: child_terminal_init_with_pgrp

void
child_terminal_init_with_pgrp (int pgrp)
{
  struct inferior *inf = current_inferior ();
  struct terminal_info *tinfo = get_inflow_inferior_data (inf);

#ifdef PROCESS_GROUP_TYPE
  /* Store the process group even without a terminal as it is used not
     only to reset the tty foreground process group, but also to
     interrupt the inferior.  */
  tinfo->process_group = pgrp;
#endif

  if (gdb_has_a_terminal ())
    {
      xfree (tinfo->ttystate);
      tinfo->ttystate = serial_copy_tty_state (stdin_serial,
					       our_terminal_info.ttystate);

      /* Make sure that next time we call terminal_inferior (which will be
         before the program runs, as it needs to be), we install the new
         process group.  */
      terminal_is_ours = 1;
    }
}
开发者ID:atgreen,项目名称:binutils-gdb,代码行数:25,代码来源:inflow.c

示例6: parse_thread_id

struct thread_info *
parse_thread_id (const char *tidstr, const char **end)
{
  const char *number = tidstr;
  const char *dot, *p1;
  struct thread_info *tp;
  struct inferior *inf;
  int thr_num;
  int explicit_inf_id = 0;

  dot = strchr (number, '.');

  if (dot != NULL)
    {
      /* Parse number to the left of the dot.  */
      int inf_num;

      p1 = number;
      inf_num = get_positive_number_trailer (&p1, '.', number);
      if (inf_num == 0)
	invalid_thread_id_error (number);

      inf = find_inferior_id (inf_num);
      if (inf == NULL)
	error (_("No inferior number '%d'"), inf_num);

      explicit_inf_id = 1;
      p1 = dot + 1;
    }
  else
    {
      inf = current_inferior ();

      p1 = number;
    }

  thr_num = get_positive_number_trailer (&p1, 0, number);
  if (thr_num == 0)
    invalid_thread_id_error (number);

  ALL_THREADS (tp)
    {
      if (ptid_get_pid (tp->ptid) == inf->pid
	  && tp->per_inf_num == thr_num)
	break;
    }

  if (tp == NULL)
    {
      if (show_inferior_qualified_tids () || explicit_inf_id)
	error (_("Unknown thread %d.%d."), inf->num, thr_num);
      else
	error (_("Unknown thread %d."), thr_num);
    }

  if (end != NULL)
    *end = p1;

  return tp;
}
开发者ID:Cookfeces,项目名称:binutils-gdb,代码行数:60,代码来源:tid-parse.c

示例7: get_task_from_args

static task_t
get_task_from_args (const char *args)
{
  task_t task;
  char *eptr;

  if (args == NULL || *args == 0)
    {
      if (ptid_equal (inferior_ptid, null_ptid))
	printf_unfiltered (_("No inferior running\n"));

      darwin_inferior *priv = get_darwin_inferior (current_inferior ());

      return priv->task;
    }
  if (strcmp (args, "gdb") == 0)
    return mach_task_self ();
  task = strtoul (args, &eptr, 0);
  if (*eptr)
    {
      printf_unfiltered (_("cannot parse task id '%s'\n"), args);
      return TASK_NULL;
    }
  return task;
}
开发者ID:sifive,项目名称:riscv-binutils-gdb,代码行数:25,代码来源:darwin-nat-info.c

示例8: mi_solib_loaded

static void
mi_solib_loaded (struct so_list *solib)
{
  struct mi_interp *mi = top_level_interpreter_data ();
  struct ui_out *uiout = interp_ui_out (top_level_interpreter ());

  target_terminal_ours ();

  fprintf_unfiltered (mi->event_channel, "library-loaded");

  ui_out_redirect (uiout, mi->event_channel);

  ui_out_field_string (uiout, "id", solib->so_original_name);
  ui_out_field_string (uiout, "target-name", solib->so_original_name);
  ui_out_field_string (uiout, "host-name", solib->so_name);
  ui_out_field_int (uiout, "symbols-loaded", solib->symbols_loaded);
  if (!gdbarch_has_global_solist (target_gdbarch ()))
    {
      ui_out_field_fmt (uiout, "thread-group", "i%d", current_inferior ()->num);
    }

  ui_out_redirect (uiout, NULL);

  gdb_flush (mi->event_channel);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:25,代码来源:mi-interp.c

示例9: inf_ptrace_attach

static void
inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
{
  char *exec_file;
  pid_t pid;
  struct inferior *inf;

  /* Do not change either targets above or the same target if already present.
     The reason is the target stack is shared across multiple inferiors.  */
  int ops_already_pushed = target_is_pushed (ops);
  struct cleanup *back_to = NULL;

  pid = parse_pid_to_attach (args);

  if (pid == getpid ())		/* Trying to masturbate?  */
    error (_("I refuse to debug myself!"));

  if (! ops_already_pushed)
    {
      /* target_pid_to_str already uses the target.  Also clear possible core
	 file with its process_stratum.  */
      push_target (ops);
      back_to = make_cleanup_unpush_target (ops);
    }

  if (from_tty)
    {
      exec_file = get_exec_file (0);

      if (exec_file)
	printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
			   target_pid_to_str (pid_to_ptid (pid)));
      else
	printf_unfiltered (_("Attaching to %s\n"),
			   target_pid_to_str (pid_to_ptid (pid)));

      gdb_flush (gdb_stdout);
    }

#ifdef PT_ATTACH
  errno = 0;
  ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0);
  if (errno != 0)
    perror_with_name (("ptrace"));
#else
  error (_("This system does not support attaching to a process"));
#endif

  inf = current_inferior ();
  inferior_appeared (inf, pid);
  inf->attach_flag = 1;
  inferior_ptid = pid_to_ptid (pid);

  /* Always add a main thread.  If some target extends the ptrace
     target, it should decorate the ptid later with more info.  */
  add_thread_silent (inferior_ptid);

  if (! ops_already_pushed)
    discard_cleanups (back_to);
}
开发者ID:rgmabs19357,项目名称:gdb,代码行数:60,代码来源:inf-ptrace.c

示例10: darwin_solib_get_all_image_info_addr_at_init

static void
darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
{
  char *interp_name;
  CORE_ADDR load_addr = 0;
  bfd *dyld_bfd = NULL;
  struct cleanup *cleanup;

  /* This method doesn't work with an attached process.  */
  if (current_inferior ()->attach_flag)
    return;

  /* Find the program interpreter.  */
  interp_name = find_program_interpreter ();
  if (!interp_name)
    return;

  cleanup = make_cleanup (null_cleanup, NULL);

  /* Create a bfd for the interpreter.  */
  dyld_bfd = gdb_bfd_open (interp_name, gnutarget, -1);
  if (dyld_bfd)
    {
      bfd *sub;

      make_cleanup_bfd_unref (dyld_bfd);
      sub = gdb_bfd_mach_o_fat_extract
	(dyld_bfd, bfd_object, gdbarch_bfd_arch_info (target_gdbarch ()));
      if (sub)
	{
	  dyld_bfd = sub;
	  make_cleanup_bfd_unref (sub);
	}
      else
	dyld_bfd = NULL;
    }
  if (!dyld_bfd)
    {
      do_cleanups (cleanup);
      return;
    }

  /* We find the dynamic linker's base address by examining
     the current pc (which should point at the entry point for the
     dynamic linker) and subtracting the offset of the entry point.  */
  load_addr = (regcache_read_pc (get_current_regcache ())
               - bfd_get_start_address (dyld_bfd));

  /* Now try to set a breakpoint in the dynamic linker.  */
  info->all_image_addr =
    lookup_symbol_from_bfd (dyld_bfd, "_dyld_all_image_infos");

  do_cleanups (cleanup);

  if (info->all_image_addr == 0)
    return;

  info->all_image_addr += load_addr;
}
开发者ID:Distrotech,项目名称:binutils,代码行数:59,代码来源:solib-darwin.c

示例11: current_inferior

void
inf_ptrace_target::files_info ()
{
  struct inferior *inf = current_inferior ();

  printf_filtered (_("\tUsing the running image of %s %s.\n"),
		   inf->attach_flag ? "attached" : "child",
		   target_pid_to_str (inferior_ptid));
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:9,代码来源:inf-ptrace.c

示例12: jit_reader_unload_command

static void
jit_reader_unload_command (const char *args, int from_tty)
{
  if (!loaded_jit_reader)
    error (_("No JIT reader loaded."));

  reinit_frame_cache ();
  jit_inferior_exit_hook (current_inferior ());

  delete loaded_jit_reader;
  loaded_jit_reader = NULL;
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:12,代码来源:jit.c

示例13: osf_solib_create_inferior_hook

static void
osf_solib_create_inferior_hook (int from_tty)
{
    struct inferior *inf;
    struct thread_info *tp;

    inf = current_inferior ();

    /* If we are attaching to the inferior, the shared libraries
       have already been mapped, so nothing more to do.  */
    if (inf->attach_flag)
        return;

    /* Nothing to do for statically bound executables.  */

    if (symfile_objfile == NULL
            || symfile_objfile->obfd == NULL
            || ((bfd_get_file_flags (symfile_objfile->obfd) & DYNAMIC) == 0))
        return;

    /* Now run the target.  It will eventually get a SIGTRAP, at
       which point all of the libraries will have been mapped in and we
       can go groveling around in the rld structures to find
       out what we need to know about them.

       If debugging from a core file, we cannot resume the execution
       of the inferior.  But this is actually not an issue, because
       shared libraries have already been mapped anyways, which means
       we have nothing more to do.  */
    if (!target_can_run (&current_target))
        return;

    tp = inferior_thread ();
    clear_proceed_status ();
    inf->stop_soon = STOP_QUIETLY;
    tp->stop_signal = TARGET_SIGNAL_0;
    do
    {
        target_resume (minus_one_ptid, 0, tp->stop_signal);
        wait_for_inferior (0);
    }
    while (tp->stop_signal != TARGET_SIGNAL_TRAP);

    /*  solib_add will call reinit_frame_cache.
       But we are stopped in the runtime loader and we do not have symbols
       for the runtime loader. So heuristic_proc_start will be called
       and will put out an annoying warning.
       Delaying the resetting of stop_soon until after symbol loading
       suppresses the warning.  */
    solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
    inf->stop_soon = NO_STOP_QUIETLY;
}
开发者ID:peterdocter,项目名称:toolchain-gdb,代码行数:52,代码来源:solib-osf.c

示例14: get_auxv_inferior_data

static struct auxv_info *
get_auxv_inferior_data (struct target_ops *ops)
{
  struct auxv_info *info;
  struct inferior *inf = current_inferior ();

  info = inferior_data (inf, auxv_inferior_data);
  if (info == NULL)
    {
      info = XZALLOC (struct auxv_info);
      info->length = target_read_alloc (ops, TARGET_OBJECT_AUXV,
					NULL, &info->data);
      set_inferior_data (inf, auxv_inferior_data, info);
    }
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:14,代码来源:auxv.c

示例15: frscm_get_frame_smob_arg_unsafe

frame_smob *
frscm_get_frame_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
{
    SCM f_scm = frscm_get_frame_arg_unsafe (self, arg_pos, func_name);
    frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);

    if (f_smob->inferior == NULL)
    {
        gdbscm_invalid_object_error (func_name, arg_pos, self,
                                     _("inferior"));
    }
    if (f_smob->inferior != current_inferior ())
        scm_misc_error (func_name, _("inferior has changed"), SCM_EOL);

    return f_smob;
}
开发者ID:cupertinomiranda,项目名称:binutils,代码行数:16,代码来源:scm-frame.c


注:本文中的current_inferior函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。