View | Details | Raw Unified | Return to bug 48183
Collapse All | Expand All

(-)freebsd-uthread.c (-4 / +74 lines)
Lines 46-51 Link Here
46
#include <sys/stat.h>
46
#include <sys/stat.h>
47
#include "gdbcore.h"
47
#include "gdbcore.h"
48
int coreops_suppress_target =3D 1; /* Ugh. Override the version in
49
extern struct target_ops core_ops;	/* target vector for corelow.c */
50
static struct target_ops orig_core_ops;	/* target vector for corelow.c */
51
48
extern int child_suppress_run;
52
extern int child_suppress_run;
49
extern struct target_ops child_ops; /* target vector for inftarg.c */
53
extern struct target_ops child_ops; /* target vector for inftarg.c */
Lines 60-65 Link Here
60
/* Pointer to the next function on the objfile event chain.  */
64
/* Pointer to the next function on the objfile event chain.  */
61
static void (*target_new_objfile_chain) (struct objfile *objfile);
65
static void (*target_new_objfile_chain) (struct objfile *objfile);
66
static void freebsd_uthread_find_new_threads (void);
62
static void freebsd_uthread_resume PARAMS ((ptid_t pid, int step,
67
static void freebsd_uthread_resume PARAMS ((ptid_t pid, int step,
63
					enum target_signal signo));
68
					enum target_signal signo));
Lines 472-478 Link Here
472
  if (freebsd_uthread_attaching || TIDGET(inferior_ptid) =3D=3D 0)
477
  if (freebsd_uthread_attaching || TIDGET(inferior_ptid) =3D=3D 0)
473
    {
478
    {
474
      child_ops.to_fetch_registers (regno);
479
      if (target_has_execution)
480
	child_ops.to_fetch_registers (regno);
481
      else
482
	orig_core_ops.to_fetch_registers (regno);
475
      return;
483
      return;
476
    }
484
    }
Lines 481-487 Link Here
481
  if (active)
489
  if (active)
482
    {
490
    {
483
      child_ops.to_fetch_registers (regno);
491
      if (target_has_execution)
492
	child_ops.to_fetch_registers (regno);
493
      else
494
	orig_core_ops.to_fetch_registers (regno);
484
      return;
495
      return;
485
    }
496
    }
Lines 501-508 Link Here
501
  for (regno =3D first_regno; regno <=3D last_regno; regno++)
512
  for (regno =3D first_regno; regno <=3D last_regno; regno++)
502
    {
513
    {
503
      if (regmap[regno] =3D=3D -1)
514
      if (regmap[regno] =3D=3D -1) {
504
	child_ops.to_fetch_registers (regno);
515
	if (target_has_execution)
516
	  child_ops.to_fetch_registers (regno);
517
	else
518
	  orig_core_ops.to_fetch_registers (regno);
519
      }
505
      else
520
      else
506
	if (thread)
521
	if (thread)
507
	  supply_register (regno, (char*) &regbase[regmap[regno]]);
522
	  supply_register (regno, (char*) &regbase[regmap[regno]]);
Lines 683-688 Link Here
683
  LOOKUP_VALUE(PS_RUNNING);
698
  LOOKUP_VALUE(PS_RUNNING);
684
  LOOKUP_VALUE(PS_DEAD);
699
  LOOKUP_VALUE(PS_DEAD);
700
  if (!target_has_execution) {
701
    read_thread_offsets();
702
    freebsd_uthread_find_new_threads();
703
  }
704
685
  freebsd_uthread_active =3D 1;
705
  freebsd_uthread_active =3D 1;
686
}
706
}
Lines 731-736 Link Here
731
  return ret;
751
  return ret;
732
}
752
}
753
static int
754
freebsd_utcore_thread_alive (ptid_t ptid)
755
{
756
    return 1;
757
}
758
759
static void
760
freebsd_utcore_attach (char *args, int from_tty)
761
{
762
  orig_core_ops.to_attach (args, from_tty);
763
  push_target (&core_ops);
764
  freebsd_uthread_attaching =3D 1;
765
}
766
767
static void
768
freebsd_utcore_detach (char *args, int from_tty)
769
{
770
  unpush_target (&core_ops);
771
  orig_core_ops.to_detach (args, from_tty);
772
}
773
733
static void
774
static void
734
freebsd_uthread_stop (void)
775
freebsd_uthread_stop (void)
735
{
776
{
Lines 874-885 Link Here
874
  freebsd_uthread_vec.get_thread_info =3D freebsd_uthread_get_thread_info;
915
  freebsd_uthread_vec.get_thread_info =3D freebsd_uthread_get_thread_info;
875
#endif
916
#endif
876
}
917
}
918
=0C
919
920
921
static void
922
init_freebsd_core_ops ()
923
{
924
  orig_core_ops =3D core_ops;
925
  core_ops.to_shortname =3D "freebsd-uthreads (corefile)";
926
  core_ops.to_longname =3D "FreeBSD uthreads (corefile)";
927
  core_ops.to_doc =3D "FreeBSD user threads support (for corefiles).";
928
  core_ops.to_has_all_memory =3D 0;
929
  core_ops.to_has_memory =3D 1;
930
  core_ops.to_has_stack =3D 1;
931
  core_ops.to_has_registers =3D 1;
932
  core_ops.to_has_execution =3D 0;
933
  core_ops.to_has_thread_control =3D tc_none;
934
  core_ops.to_magic =3D OPS_MAGIC;
935
  core_ops.to_pid_to_str =3D freebsd_uthread_pid_to_str;
936
  core_ops.to_thread_alive =3D freebsd_utcore_thread_alive;
937
  core_ops.to_attach =3D freebsd_utcore_attach;
938
  core_ops.to_detach =3D freebsd_utcore_detach;
939
  core_ops.to_stratum =3D core_stratum;
940
  core_ops.to_find_new_threads =3D freebsd_uthread_find_new_threads;
941
  core_ops.to_fetch_registers =3D freebsd_uthread_fetch_registers;
942
  core_ops.to_sections =3D 0;
943
  core_ops.to_sections_end =3D 0;
944
}
877
void
945
void
878
_initialize_freebsd_uthread ()
946
_initialize_freebsd_uthread ()
879
{
947
{
880
  init_freebsd_uthread_ops ();
948
  init_freebsd_uthread_ops ();
949
  init_freebsd_core_ops ();
881
  add_target (&freebsd_uthread_ops);
950
  add_target (&freebsd_uthread_ops);
951
  add_target (&core_ops);
882
  target_new_objfile_chain =3D target_new_objfile_hook;
952
  target_new_objfile_chain =3D target_new_objfile_hook;
883
  target_new_objfile_hook =3D freebsd_uthread_new_objfile;
953
  target_new_objfile_hook =3D freebsd_uthread_new_objfile;

Return to bug 48183