/* APPLE LOCAL file Darwin */
/* Native support for Mac OS X for GDB, the GNU debugger.
   Copyright (C) 1997-2002,
   Free Software Foundation, Inc.

This file is part of GDB.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#ifndef _NM_NEXTSTEP_H_
#define _NM_NEXTSTEP_H_

#define ATTACH_DETACH
#define ATTACH_NO_WAIT

struct target_waitstatus;
struct target_ops;

extern int child_wait (int, struct target_waitstatus *, void *);
#define CHILD_WAIT

#define FETCH_INFERIOR_REGISTERS

#define DISABLE_UNSETTABLE_BREAK(addr) 1

int macosx_solib_add (const char *filename, int from_tty,
		  struct target_ops *targ, int loadsyms);
#define SOLIB_ADD(filename, from_tty, targ, loadsyms) \
  macosx_solib_add (filename, from_tty, targ, loadsyms)

#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) 0

#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) 0

#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) 0

#define SOLIB_CREATE_CATCH_LOAD_HOOK(pid,tempflag,filename,cond_string) \
  error("catch of library loads/unloads not yet implemented on this platform")

#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid,tempflag,filename,cond_string) \
  error("catch of library loads/unloads not yet implemented on this platform")

extern void macosx_add_shared_symbol_files ();
#define ADD_SHARED_SYMBOL_FILES(args, from_tty) \
  macosx_add_shared_symbol_files (args, from_tty)

enum ptracereq {
  PTRACE_TRACEME = 0,		/* 0, by tracee to begin tracing */
  PTRACE_CHILDDONE = 0,		/* 0, tracee is done with his half */
  PTRACE_PEEKTEXT,		/* 1, read word from text segment */
  PTRACE_PEEKDATA,		/* 2, read word from data segment */
  PTRACE_PEEKUSER,		/* 3, read word from user struct */
  PTRACE_POKETEXT,		/* 4, write word into text segment */
  PTRACE_POKEDATA,		/* 5, write word into data segment */
  PTRACE_POKEUSER,		/* 6, write word into user struct */
  PTRACE_CONT,			/* 7, continue process */
  PTRACE_KILL,			/* 8, terminate process */
  PTRACE_SINGLESTEP,		/* 9, single step process */
  PTRACE_ATTACH,		/* 10, attach to an existing process */
  PTRACE_DETACH,		/* 11, detach from a process */
  PTRACE_SIGEXC,		/* 12, signals as exceptions for current process */
  PTRACE_THUPDATE,		/* 13, signal for thread */
  PTRACE_ATTACHEXC		/* 14, attach to running process with signals as exceptions */
};

#define TARGET_HAS_HARDWARE_WATCHPOINTS

int macosx_can_use_hw_watchpoint (int type, int cnt, int ot);
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
  macosx_can_use_hw_watchpoint(type, cnt, ot)

int macosx_region_ok_for_hw_watchpoint (CORE_ADDR start, LONGEST len);
#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(start, len) \
  macosx_region_ok_for_hw_watchpoint (start, len)

int macosx_stopped_by_watchpoint (struct target_waitstatus *w, int, int);
#define STOPPED_BY_WATCHPOINT(w) \
  macosx_stopped_by_watchpoint (&w, stop_signal, stepped_after_stopped_by_watchpoint)

#undef HAVE_STEPPABLE_WATCHPOINT
#define HAVE_NONSTEPPABLE_WATCHPOINT 1
#undef HAVE_CONTINUABLE_WATCHPOINT

void macosx_enable_page_protection_events (int pid);
#define TARGET_ENABLE_HW_WATCHPOINTS(pid) \
  macosx_enable_page_protection_events (pid)

void macosx_disable_page_protection_events (int pid);
#define TARGET_DISABLE_HW_WATCHPOINTS(pid) \
  macosx_disable_page_protection_events (pid)

int macosx_insert_watchpoint (CORE_ADDR addr, size_t len, int type);
#define target_insert_watchpoint(addr, len, type) \
  macosx_insert_watchpoint (addr, len, type)

int macosx_remove_watchpoint (CORE_ADDR addr, size_t len, int type);
#define target_remove_watchpoint(addr, len, type) \
  macosx_remove_watchpoint (addr, len, type)

char **macosx_process_completer (char *text, char *word);
#define PROCESS_COMPLETER \
  macosx_process_completer

#define PROCESS_COMPLETER_WORD_BREAK_CHARACTERS \
  gdb_completer_filename_word_break_characters

#define ENABLE_INCREDIBLY_INAPPROPRIATE_MACOSX_SPECIFIC_HACKS_IN_GENERIC_CODE
#define NM_NEXTSTEP

/* Dummy definition */
const char *macosx_pc_solib (CORE_ADDR addr);
#define PC_SOLIB(addr) ((char *) macosx_pc_solib (addr))

char *macosx_filename_in_bundle (const char *filename, int mainline);

#endif /* _NM_NEXTSTEP_H_ */
