[Pkg-mono-svn-commits] [SCM] mono-debugger branch, master, updated. debian/2.6.3-2-14-gfa909e2
Iain Lane
laney at debian.org
Thu Oct 20 12:47:35 UTC 2011
The following commit has been merged in the master branch:
commit abe812482483d6c4aff81177e83ff4fd6b7e3c4e
Author: Jari Aalto <jari.aalto at cante.net>
Date: Mon Oct 18 13:01:07 2010 +0300
Imported Debian patch 2.6.3-2.1
diff --git a/ChangeLog b/ChangeLog
index cc2a0a9..b43d4c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,37 +1,3 @@
-2010-07-31 Martin Baulig <martin at ximian.com>
-
- Welcome to GitHub :-)
-
-2010-06-09 Martin Baulig <martin at ximian.com>
-
- * backend/ProcessServant.cs: When attaching, compute initial
- stackframe for all threads.
-
-2010-06-07 Martin Baulig <martin at ximian.com>
-
- * backend/server/x86-linux-ptrace.c: Use
- mono_debugger_get_thread_abort_signal() instead of
- mono_thread_get_abort_signal().
-
- * backend/server/darwin-ptrace.c: Likewise.
-
-2010-06-07 Martin Baulig <martin at ximian.com>
-
- * configure.in: Require `mono-2', not `mono'.
-
-2010-07-15 Martin Baulig <martin at ximian.com>
-
- * configure.in: Support both 2.6 and trunk.
-
- * backend/EventQueue.cs: Use the managed Monitor class instead of
- glib's threading functions.
-
- * backend/server/mutex.[ch]: Removed.
-
-2010-03-03 Miguel de Icaza <miguel at novell.com>
-
- * Apply patch from Priit Laes <plaes at plaes.org> to build with make -j
-
2010-02-23 Martin Baulig <martin at ximian.com>
* backend/SingleSteppingEngine.cs
diff --git a/Makefile.am b/Makefile.am
index 4a74e74..d59ab64 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = sysdeps interface languages classes backend symbolwriter frontend test build
+SUBDIRS = interface languages classes backend symbolwriter frontend test build
DIST_SUBDIRS= doc $(SUBDIRS)
diff --git a/Makefile.in b/Makefile.in
index d39b6de..1224cde 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -155,6 +155,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
@@ -233,7 +234,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = sysdeps interface languages classes backend symbolwriter frontend test build
+SUBDIRS = interface languages classes backend symbolwriter frontend test build
DIST_SUBDIRS = doc $(SUBDIRS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = mono-debugger.pc mono-debugger-frontend.pc
diff --git a/acinclude.m4 b/acinclude.m4
index bfb9076..447ce46 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,3 +1,30 @@
+AC_DEFUN([CHECK_READLINE], [
+ lib="$1"
+
+ old_LIBS=$LIBS
+
+ LIBS="-ltermcap"
+ AC_TRY_LINK(,[tgetent();],[
+ READLINE_DEPLIBS=$LIBS
+ ],[
+ LIBS="-lcurses"
+ AC_TRY_LINK(,[tgetent();],[
+ READLINE_DEPLIBS=$LIBS
+ ],[
+ LIBS="-lncurses"
+ AC_TRY_LINK(,[tgetent();],[
+ READLINE_DEPLIBS=$LIBS
+ ],[
+ AC_MSG_ERROR([Cannot find termcap library])
+ ])
+ ])
+ ])
+
+ LIBS=$old_LIBS
+ AC_SUBST(READLINE_DEPLIBS)
+])
+
+
AC_DEFUN([LINUX_NPTL_CHECK], [
old_LIBS=$LIBS
LIBS="$LIBS -lpthread"
diff --git a/backend/DebuggerServant.cs b/backend/DebuggerServant.cs
new file mode 100644
index 0000000..f1e751e
--- /dev/null
+++ b/backend/DebuggerServant.cs
@@ -0,0 +1,356 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Configuration;
+using System.Globalization;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+
+using Mono.Debugger.Backend;
+using Mono.Debugger.Languages;
+using Mono.Debugger.Languages.Mono;
+
+namespace Mono.Debugger.Backend
+{
+ internal class DebuggerServant : DebuggerMarshalByRefObject, IOperationHost, IDisposable
+ {
+ Debugger client;
+ DebuggerConfiguration config;
+ ThreadManager thread_manager;
+ Hashtable process_hash;
+ ProcessServant main_process;
+
+ internal DebuggerServant (Debugger client, ReportWriter writer,
+ DebuggerConfiguration config)
+ {
+ this.client = client;
+ this.config = config;
+ Report.Initialize (writer);
+ ObjectCache.Initialize ();
+ thread_manager = new ThreadManager (this);
+ process_hash = Hashtable.Synchronized (new Hashtable ());
+ stopped_event = new ManualResetEvent (false);
+ }
+
+ public Debugger Client {
+ get { return client; }
+ }
+
+ public DebuggerConfiguration Configuration {
+ get { return config; }
+ }
+
+ internal ThreadManager ThreadManager {
+ get { return thread_manager; }
+ }
+
+ internal void OnModuleLoaded (Module module)
+ {
+ client.OnModuleLoadedEvent (module);
+ }
+
+ internal void OnModuleUnLoaded (Module module)
+ {
+ client.OnModuleUnLoadedEvent (module);
+ }
+
+ internal void OnMainProcessCreatedEvent (ProcessServant process)
+ {
+ process_hash.Add (process, process);
+ client.OnMainProcessCreatedEvent (process.Client);
+ }
+
+ internal void OnProcessCreatedEvent (ProcessServant process)
+ {
+ process_hash.Add (process, process);
+ client.OnProcessCreatedEvent (process.Client);
+ }
+
+ internal void OnTargetExitedEvent ()
+ {
+ client.OnTargetExitedEvent ();
+ }
+
+ internal void OnProcessExitedEvent (ProcessServant process)
+ {
+ process_hash.Remove (process);
+ client.OnProcessExitedEvent (process.Client);
+
+ if (process_hash.Count == 0)
+ OnTargetExitedEvent ();
+ }
+
+ internal void OnProcessExecdEvent (ProcessServant process)
+ {
+ client.OnProcessExecdEvent (process.Client);
+ }
+
+ internal void OnThreadCreatedEvent (Thread thread)
+ {
+ client.OnThreadCreatedEvent (thread);
+ }
+
+ internal void OnThreadExitedEvent (Thread thread)
+ {
+ client.OnThreadExitedEvent (thread);
+ }
+
+ internal void SendTargetEvent (SingleSteppingEngine sse, TargetEventArgs args)
+ {
+ try {
+ client.OnTargetEvent (sse.Thread, args);
+ } catch (Exception ex) {
+ Error ("{0} caught exception while sending {1}:\n{2}",
+ sse, args, ex);
+ }
+ }
+
+ internal void OnEnterNestedBreakState (SingleSteppingEngine sse)
+ {
+ client.OnEnterNestedBreakState (sse.Thread);
+ }
+
+ internal void OnLeaveNestedBreakState (SingleSteppingEngine sse)
+ {
+ client.OnLeaveNestedBreakState (sse.Thread);
+ }
+
+ public void Kill ()
+ {
+ main_process = null;
+
+ ProcessServant[] procs;
+ lock (process_hash.SyncRoot) {
+ procs = new ProcessServant [process_hash.Count];
+ process_hash.Values.CopyTo (procs, 0);
+ }
+
+ foreach (ProcessServant proc in procs) {
+ proc.Kill ();
+ }
+ }
+
+ public bool CanDetach {
+ get {
+ return (main_process != null) && main_process.CanDetach;
+ }
+ }
+
+ public void Detach ()
+ {
+ if (main_process == null)
+ throw new TargetException (TargetError.NoTarget);
+ else if (!main_process.CanDetach)
+ throw new TargetException (TargetError.CannotDetach);
+
+ ProcessServant[] procs;
+ lock (process_hash.SyncRoot) {
+ procs = new ProcessServant [process_hash.Count];
+ process_hash.Values.CopyTo (procs, 0);
+ }
+
+ foreach (ProcessServant proc in procs) {
+ proc.Detach ();
+ }
+ }
+
+ public Process Run (DebuggerSession session, out CommandResult result)
+ {
+ check_disposed ();
+
+ if (main_process != null)
+ throw new TargetException (TargetError.AlreadyHaveTarget);
+
+ ProcessStart start = new ProcessStart (session);
+ main_process = thread_manager.StartApplication (start, out result);
+ return main_process.Client;
+ }
+
+ public Process Attach (DebuggerSession session, int pid, out CommandResult result)
+ {
+ check_disposed ();
+
+ if (main_process != null)
+ throw new TargetException (TargetError.AlreadyHaveTarget);
+
+ ProcessStart start = new ProcessStart (session, pid);
+ main_process = thread_manager.StartApplication (start, out result);
+ return main_process.Client;
+ }
+
+ public Process OpenCoreFile (DebuggerSession session, string core_file,
+ out Thread[] threads)
+ {
+ check_disposed ();
+
+ if (main_process != null)
+ throw new TargetException (TargetError.AlreadyHaveTarget);
+
+ ProcessStart start = new ProcessStart (session, core_file);
+
+ main_process = thread_manager.OpenCoreFile (start, out threads);
+ process_hash.Add (main_process, main_process);
+ return main_process.Client;
+ }
+
+ public Process[] Processes {
+ get {
+ lock (process_hash.SyncRoot) {
+ int count = process_hash.Count;
+ Process[] procs = new Process [count];
+ ProcessServant[] servants = new ProcessServant [count];
+ process_hash.Values.CopyTo (servants, 0);
+ for (int i = 0; i < count; i++)
+ procs [i] = servants [i].Client;
+ return procs;
+ }
+ }
+ }
+
+ public void Error (string message, params object[] args)
+ {
+ Console.WriteLine ("ERROR: " + String.Format (message, args));
+ }
+
+#region Global Threading Model
+
+ ManualResetEvent stopped_event;
+ OperationCommandResult current_operation;
+
+ internal WaitHandle WaitHandle {
+ get { return stopped_event; }
+ }
+
+ internal CommandResult StartOperation (ThreadingModel model, SingleSteppingEngine caller)
+ {
+ if (!ThreadManager.InBackgroundThread)
+ throw new InternalError ();
+
+ if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Default) {
+ if (Inferior.HasThreadEvents)
+ model |= ThreadingModel.Single;
+ else
+ model |= ThreadingModel.Process;
+ }
+
+ if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Global)
+ return caller.Process.StartOperation (model, caller);
+
+ if (current_operation != null)
+ throw new TargetException (TargetError.NotStopped);
+
+ lock (this) {
+ stopped_event.Reset ();
+ current_operation = new GlobalCommandResult (this, model);
+ }
+
+ foreach (ProcessServant process in process_hash.Values) {
+ process.StartGlobalOperation (model, caller, current_operation);
+ }
+
+ return current_operation;
+ }
+
+ public void OperationCompleted (SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
+ {
+ if (!ThreadManager.InBackgroundThread)
+ throw new InternalError ();
+
+ foreach (ProcessServant process in process_hash.Values) {
+ process.OperationCompleted (caller, result, model);
+ }
+
+ lock (this) {
+ current_operation = null;
+ stopped_event.Set ();
+ }
+ }
+
+ WaitHandle IOperationHost.WaitHandle {
+ get { return stopped_event; }
+ }
+
+ void IOperationHost.SendResult (SingleSteppingEngine sse, TargetEventArgs args)
+ {
+ SendTargetEvent (sse, args);
+ }
+
+ void IOperationHost.Abort ()
+ {
+ foreach (ProcessServant process in process_hash.Values) {
+ process.Stop ();
+ }
+ }
+
+ protected class GlobalCommandResult : OperationCommandResult
+ {
+ public DebuggerServant Debugger {
+ get; private set;
+ }
+
+ internal override IOperationHost Host {
+ get { return Debugger; }
+ }
+
+ internal GlobalCommandResult (DebuggerServant debugger, ThreadingModel model)
+ : base (model)
+ {
+ this.Debugger = debugger;
+ }
+
+ internal override void OnExecd (SingleSteppingEngine new_thread)
+ { }
+ }
+
+#endregion
+
+ //
+ // IDisposable
+ //
+
+ private bool disposed = false;
+
+ private void check_disposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException ("Debugger");
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ // Check to see if Dispose has already been called.
+ lock (this) {
+ if (disposed)
+ return;
+
+ disposed = true;
+ }
+
+ // If this is a call to Dispose, dispose all managed resources.
+ if (disposing) {
+ if (thread_manager != null) {
+ thread_manager.Dispose ();
+ thread_manager = null;
+ }
+
+ ObjectCache.Shutdown ();
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ // Take yourself off the Finalization queue
+ GC.SuppressFinalize (this);
+ }
+
+ ~DebuggerServant ()
+ {
+ Dispose (false);
+ }
+ }
+}
diff --git a/backend/EventQueue.cs b/backend/EventQueue.cs
index a7e4ae3..4550cad 100644
--- a/backend/EventQueue.cs
+++ b/backend/EventQueue.cs
@@ -75,28 +75,47 @@ namespace Mono.Debugger.Backend
internal class DebuggerMutex : DebuggerWaitHandle
{
+ protected IntPtr handle;
+
+ [DllImport("monodebuggerserver")]
+ static extern IntPtr mono_debugger_mutex_new ();
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_mutex_free (IntPtr handle);
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_mutex_lock (IntPtr handle);
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_mutex_unlock (IntPtr handle);
+
+ [DllImport("monodebuggerserver")]
+ static extern bool mono_debugger_mutex_trylock (IntPtr handle);
+
public DebuggerMutex (string name)
: base (name)
- { }
+ {
+ handle = mono_debugger_mutex_new ();
+ }
public void Lock ()
{
Debug ("{0} locking {1}", CurrentThread, Name);
- Monitor.Enter (this);
+ mono_debugger_mutex_lock (handle);
Debug ("{0} locked {1}", CurrentThread, Name);
}
public void Unlock ()
{
Debug ("{0} unlocking {1}", CurrentThread, Name);
- Monitor.Exit (this);
+ mono_debugger_mutex_unlock (handle);
Debug ("{0} unlocked {1}", CurrentThread, Name);
}
public override bool TryLock ()
{
Debug ("{0} trying to lock {1}", CurrentThread, Name);
- bool success = Monitor.TryEnter (this);
+ bool success = mono_debugger_mutex_trylock (handle);
if (success)
Debug ("{0} locked {1}", CurrentThread, Name);
else
@@ -105,25 +124,47 @@ namespace Mono.Debugger.Backend
}
protected override void DoDispose ()
- { }
+ {
+ mono_debugger_mutex_free (handle);
+ handle = IntPtr.Zero;
+ }
}
internal class DebuggerEventQueue : DebuggerMutex
{
+ IntPtr cond;
+
+ [DllImport("monodebuggerserver")]
+ static extern IntPtr mono_debugger_cond_new ();
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_cond_free (IntPtr handle);
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_cond_wait (IntPtr mutex, IntPtr cond);
+
+ [DllImport ("monodebuggerserver")]
+ static extern bool mono_debugger_cond_timed_wait (IntPtr mutex, IntPtr cond, int milliseconds);
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_cond_broadcast (IntPtr cond);
+
public DebuggerEventQueue (string name)
: base (name)
- { }
+ {
+ cond = mono_debugger_cond_new ();
+ }
public void Wait ()
{
Debug ("{0} waiting {1}", CurrentThread, Name);
- Monitor.Wait (this);
+ mono_debugger_cond_wait (handle, cond);
Debug ("{0} done waiting {1}", CurrentThread, Name);
}
public bool Wait (int milliseconds) {
Debug ("{0} waiting {1}", CurrentThread, Name);
- bool ret = Monitor.Wait (this, milliseconds);
+ bool ret = mono_debugger_cond_timed_wait (handle, cond, milliseconds);
Debug ("{0} done waiting {1}", CurrentThread, Name);
return ret;
}
@@ -131,10 +172,13 @@ namespace Mono.Debugger.Backend
public void Signal ()
{
Debug ("{0} signal {1}", CurrentThread, Name);
- Monitor.Pulse (this);
+ mono_debugger_cond_broadcast (cond);
}
protected override void DoDispose ()
- { }
+ {
+ mono_debugger_cond_free (cond);
+ cond = IntPtr.Zero;
+ }
}
}
diff --git a/backend/Inferior.cs b/backend/Inferior.cs
index f03e557..6596dbc 100644
--- a/backend/Inferior.cs
+++ b/backend/Inferior.cs
@@ -25,7 +25,7 @@ namespace Mono.Debugger.Backend
protected readonly ProcessStart start;
- protected readonly Process process;
+ protected readonly ProcessServant process;
protected readonly DebuggerErrorHandler error_handler;
protected readonly BreakpointManager breakpoint_manager;
protected readonly AddressDomain address_domain;
@@ -309,7 +309,7 @@ namespace Mono.Debugger.Backend
}
}
- protected Inferior (ThreadManager thread_manager, Process process,
+ protected Inferior (ThreadManager thread_manager, ProcessServant process,
ProcessStart start, BreakpointManager bpm,
DebuggerErrorHandler error_handler,
AddressDomain address_domain)
@@ -328,7 +328,7 @@ namespace Mono.Debugger.Backend
}
public static Inferior CreateInferior (ThreadManager thread_manager,
- Process process, ProcessStart start)
+ ProcessServant process, ProcessStart start)
{
return new Inferior (
thread_manager, process, start, process.BreakpointManager, null,
@@ -620,7 +620,7 @@ namespace Mono.Debugger.Backend
}
}
- public Process Process {
+ public ProcessServant Process {
get {
return process;
}
@@ -1722,7 +1722,7 @@ namespace Mono.Debugger.Backend
}
}
- public static OperatingSystemBackend CreateOperatingSystemBackend (Process process)
+ public static OperatingSystemBackend CreateOperatingSystemBackend (ProcessServant process)
{
ServerType type = mono_debugger_server_get_server_type ();
switch (type) {
diff --git a/backend/Makefile.am b/backend/Makefile.am
index 3291f5a..6a86764 100644
--- a/backend/Makefile.am
+++ b/backend/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = arch os mono
+SUBDIRS = arch os mono server
EXTRA_DIST = $(srcdir)/*.cs
diff --git a/backend/Makefile.in b/backend/Makefile.in
index 734eba7..066d991 100644
--- a/backend/Makefile.in
+++ b/backend/Makefile.in
@@ -129,6 +129,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
@@ -207,7 +208,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = arch os mono
+SUBDIRS = arch os mono server
EXTRA_DIST = $(srcdir)/*.cs
all: all-recursive
diff --git a/backend/ProcessServant.cs b/backend/ProcessServant.cs
new file mode 100644
index 0000000..9a157c1
--- /dev/null
+++ b/backend/ProcessServant.cs
@@ -0,0 +1,1011 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Collections;
+using System.Collections.Generic;
+using ST = System.Threading;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+using Mono.Debugger.Backend;
+using Mono.Debugger.Backend.Mono;
+using Mono.Debugger.Architectures;
+using Mono.Debugger.Languages;
+using Mono.Debugger.Languages.Native;
+using Mono.Debugger.Languages.Mono;
+
+namespace Mono.Debugger.Backend
+{
+ internal class ProcessServant : DebuggerMarshalByRefObject, IOperationHost
+ {
+ Process client;
+ TargetInfo target_info;
+ ThreadManager manager;
+ Architecture architecture;
+ OperatingSystemBackend os;
+ NativeLanguage native_language;
+ SymbolTableManager symtab_manager;
+ MonoThreadManager mono_manager;
+ BreakpointManager breakpoint_manager;
+ Dictionary<int,ExceptionCatchPoint> exception_handlers;
+ ProcessStart start;
+ DebuggerSession session;
+ protected MonoLanguageBackend mono_language;
+ protected ThreadServant main_thread;
+ Hashtable thread_hash;
+
+ ProcessServant parent;
+
+ ThreadDB thread_db;
+
+ bool is_attached;
+ bool is_execed;
+ bool is_forked;
+ bool initialized;
+ DebuggerMutex thread_lock_mutex;
+ bool has_thread_lock;
+
+ int id = ++next_id;
+ static int next_id = 0;
+
+ private ProcessServant (ThreadManager manager, DebuggerSession session)
+ {
+ this.manager = manager;
+ this.session = session;
+ this.client = manager.Debugger.Client.CreateProcess (this);
+
+ thread_lock_mutex = new DebuggerMutex ("thread_lock_mutex");
+
+ stopped_event = new ST.ManualResetEvent (false);
+
+ thread_hash = Hashtable.Synchronized (new Hashtable ());
+
+ target_info = Inferior.GetTargetInfo ();
+ if (target_info.TargetAddressSize == 8)
+ architecture = new Architecture_X86_64 (this, target_info);
+ else
+ architecture = new Architecture_I386 (this, target_info);
+ }
+
+ internal ProcessServant (ThreadManager manager, ProcessStart start)
+ : this (manager, start.Session)
+ {
+ this.start = start;
+
+ is_attached = start.PID != 0;
+
+ breakpoint_manager = new BreakpointManager ();
+
+ exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
+
+ symtab_manager = new SymbolTableManager (session);
+
+ os = Inferior.CreateOperatingSystemBackend (this);
+ native_language = new NativeLanguage (this, os, target_info);
+
+ session.OnProcessCreated (client);
+ }
+
+ private ProcessServant (ProcessServant parent, int pid)
+ : this (parent.manager, parent.session)
+ {
+ this.start = new ProcessStart (parent.ProcessStart, pid);
+
+ this.is_forked = true;
+ this.initialized = true;
+
+ this.parent = parent;
+
+ breakpoint_manager = new BreakpointManager (parent.breakpoint_manager);
+
+ exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
+ foreach (KeyValuePair<int,ExceptionCatchPoint> catchpoint in parent.exception_handlers)
+ exception_handlers.Add (catchpoint.Key, catchpoint.Value);
+
+ symtab_manager = parent.symtab_manager;
+
+ native_language = parent.native_language;
+ os = parent.os;
+ }
+
+ public int ID {
+ get { return id; }
+ }
+
+ public bool IsAttached {
+ get { return is_attached; }
+ }
+
+ public bool CanDetach {
+ get { return is_attached || Inferior.CanDetachAny; }
+ }
+
+ public bool IsExeced {
+ get { return is_execed; }
+ }
+
+ public Process Client {
+ get { return client; }
+ }
+
+ public DebuggerSession Session {
+ get { return session; }
+ }
+
+ internal ThreadManager ThreadManager {
+ get { return manager; }
+ }
+
+ internal Architecture Architecture {
+ get { return architecture; }
+ }
+
+ internal BreakpointManager BreakpointManager {
+ get { return breakpoint_manager; }
+ }
+
+ internal SymbolTableManager SymbolTableManager {
+ get {
+ return symtab_manager;
+ }
+ }
+
+ public NativeLanguage NativeLanguage {
+ get { return native_language; }
+ }
+
+ public OperatingSystemBackend OperatingSystem {
+ get { return os; }
+ }
+
+ public ThreadServant MainThread {
+ get { return main_thread; }
+ }
+
+ public DebuggerServant Debugger {
+ get { return manager.Debugger; }
+ }
+
+ internal ProcessStart ProcessStart {
+ get { return start; }
+ }
+
+ internal MonoThreadManager MonoManager {
+ get { return mono_manager; }
+ }
+
+ internal bool MonoRuntimeFound {
+ get; private set;
+ }
+
+ public bool IsManaged {
+ get { return mono_manager != null; }
+ }
+
+ internal bool CanExecuteCode {
+ get { return (mono_manager != null) && mono_manager.CanExecuteCode; }
+ }
+
+ public string TargetApplication {
+ get { return start.TargetApplication; }
+ }
+
+ public string[] CommandLineArguments {
+ get { return start.CommandLineArguments; }
+ }
+
+ internal ST.WaitHandle WaitHandle {
+ get { return stopped_event; }
+ }
+
+ internal void ThreadCreated (Inferior inferior, int pid, bool do_attach, bool resume_thread)
+ {
+ Inferior new_inferior = inferior.CreateThread (pid, do_attach);
+
+ SingleSteppingEngine new_thread = new SingleSteppingEngine (manager, this, new_inferior, pid);
+
+ Report.Debug (DebugFlags.Threads, "Thread created: {0} {1} {2}", pid, new_thread, do_attach);
+
+ if (mono_manager != null)
+ mono_manager.ThreadCreated (new_thread);
+
+ if (!do_attach && !is_execed)
+ get_thread_info (inferior, new_thread);
+ OnThreadCreatedEvent (new_thread);
+
+ if (resume_thread) {
+ CommandResult result = current_operation != null ?
+ current_operation : new ThreadCommandResult (new_thread.Thread);
+ new_thread.StartThread (result);
+ }
+ }
+
+ internal void ChildForked (Inferior inferior, int pid)
+ {
+ ProcessServant new_process = new ProcessServant (this, pid);
+ new_process.ProcessStart.StopInMain = false;
+
+ Inferior new_inferior = Inferior.CreateInferior (
+ manager, new_process, new_process.ProcessStart);
+ new_inferior.InitializeThread (pid);
+
+ if (!manager.Debugger.Configuration.FollowFork) {
+ new_inferior.DetachAfterFork ();
+ return;
+ }
+
+ SingleSteppingEngine new_thread = new SingleSteppingEngine (
+ manager, new_process, new_inferior, pid);
+
+ Report.Debug (DebugFlags.Threads, "Child forked: {0} {1}", pid, new_thread);
+
+ new_process.main_thread = new_thread;
+
+ manager.Debugger.OnProcessCreatedEvent (new_process);
+ new_process.OnThreadCreatedEvent (new_thread);
+
+ CommandResult result = new_process.CloneParentOperation (new_thread);
+ new_thread.StartForkedChild (result);
+ }
+
+ internal void ChildExecd (SingleSteppingEngine engine, Inferior inferior)
+ {
+ is_execed = true;
+
+ if (!is_forked) {
+ if (mono_language != null)
+ mono_language.Dispose();
+
+ if (native_language != null)
+ native_language.Dispose ();
+
+ if (os != null)
+ os.Dispose ();
+
+ if (symtab_manager != null)
+ symtab_manager.Dispose ();
+ }
+
+ if (breakpoint_manager != null)
+ breakpoint_manager.Dispose ();
+
+ session.OnProcessExecd (client);
+
+ breakpoint_manager = new BreakpointManager ();
+
+ exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
+
+ symtab_manager = new SymbolTableManager (session);
+
+ os = Inferior.CreateOperatingSystemBackend (this);
+ native_language = new NativeLanguage (this, os, target_info);
+
+ Inferior new_inferior = Inferior.CreateInferior (manager, this, start);
+ try {
+ new_inferior.InitializeAfterExec (inferior.PID);
+ } catch (Exception ex) {
+ if ((ex is TargetException) && (((TargetException) ex).Type == TargetError.PermissionDenied)) {
+ Report.Error ("Permission denied when trying to debug exec()ed child {0}, detaching!",
+ inferior.PID);
+ } else {
+ Report.Error ("InitializeAfterExec() failed on pid {0}: {1}", inferior.PID, ex);
+ }
+ new_inferior.DetachAfterFork ();
+ return;
+ }
+
+ SingleSteppingEngine new_thread = new SingleSteppingEngine (
+ manager, this, new_inferior, inferior.PID);
+
+ ThreadServant[] threads;
+ lock (thread_hash.SyncRoot) {
+ threads = new ThreadServant [thread_hash.Count];
+ thread_hash.Values.CopyTo (threads, 0);
+ }
+
+ for (int i = 0; i < threads.Length; i++) {
+ if (threads [i].PID != inferior.PID)
+ threads [i].Kill ();
+ }
+
+ thread_hash [inferior.PID] = new_thread;
+
+ inferior.Dispose ();
+ inferior = null;
+
+ manager.Debugger.OnProcessExecdEvent (this);
+ manager.Debugger.OnThreadCreatedEvent (new_thread.Thread);
+ initialized = is_forked = false;
+ main_thread = new_thread;
+
+ if ((engine.Thread.ThreadFlags & Thread.Flags.StopOnExit) != 0)
+ new_thread.Thread.ThreadFlags |= Thread.Flags.StopOnExit;
+
+ CommandResult result = engine.OnExecd (new_thread);
+ new_thread.StartExecedChild (result);
+ }
+
+ internal CommandResult StartApplication ()
+ {
+ SingleSteppingEngine engine = new SingleSteppingEngine (manager, this, start);
+
+ initialized = true;
+
+ this.main_thread = engine;
+ engine.Thread.ThreadFlags |= Thread.Flags.StopOnExit;
+
+ if (thread_hash.Contains (engine.PID))
+ thread_hash [engine.PID] = engine;
+ else
+ thread_hash.Add (engine.PID, engine);
+ session.MainThreadGroup.AddThread (engine.Thread.ID);
+
+ session.OnMainProcessCreated (client);
+ manager.Debugger.OnMainProcessCreatedEvent (this);
+
+ CommandResult result = Debugger.StartOperation (start.Session.Config.ThreadingModel, engine);
+ return engine.StartApplication (result);
+ }
+
+ internal void OnProcessExitedEvent ()
+ {
+ DropGlobalThreadLock ();
+
+ if (current_state == ProcessState.Running) {
+ current_state = ProcessState.Exited;
+ current_operation.Completed ();
+ current_operation = null;
+ stopped_event.Set ();
+ }
+
+ if (!is_forked)
+ session.OnProcessExited (client);
+ session.MainThreadGroup.RemoveThread (main_thread.ID);
+ manager.Debugger.OnProcessExitedEvent (this);
+ }
+
+ protected void OnThreadCreatedEvent (ThreadServant thread)
+ {
+ thread_hash.Add (thread.PID, thread);
+ manager.Debugger.OnThreadCreatedEvent (thread.Client);
+ }
+
+ internal void OnManagedThreadExitedEvent (ThreadServant thread)
+ {
+ thread_hash.Remove (thread.PID);
+ }
+
+ internal void OnProcessReachedMainEvent ()
+ {
+ manager.Debugger.Client.OnProcessReachedMainEvent (client);
+ }
+
+ internal void OnThreadExitedEvent (ThreadServant thread)
+ {
+ thread_hash.Remove (thread.PID);
+ thread.ThreadGroup.RemoveThread (thread.ID);
+ session.DeleteThreadGroup (thread.ThreadGroup.Name);
+ manager.Debugger.OnThreadExitedEvent (thread.Client);
+
+ if (thread_hash.Count == 0)
+ OnProcessExitedEvent ();
+ }
+
+ internal void OnTargetOutput (bool is_stderr, string output)
+ {
+ client.OnTargetOutput (is_stderr, output);
+ }
+
+ internal void InitializeMono (Inferior inferior, TargetAddress mdb_debug_info)
+ {
+ MonoRuntimeFound = true;
+ mono_manager = MonoThreadManager.Initialize (this, inferior, mdb_debug_info, is_attached);
+
+ InitializeThreads (inferior, !is_attached);
+
+ if (mono_manager == null)
+ return;
+
+ mono_manager.InitializeThreads (inferior);
+
+ if (is_attached)
+ mono_manager.InitializeAfterAttach (inferior);
+ }
+
+ internal void InitializeThreads (Inferior inferior, bool resume_threads)
+ {
+ if (thread_db != null)
+ return;
+
+ thread_db = ThreadDB.Create (this, inferior);
+ if (thread_db == null) {
+ if (!IsManaged)
+ return;
+
+ Report.Error ("Failed to initialize thread_db on {0}", start.CommandLine);
+ throw new TargetException (TargetError.CannotStartTarget,
+ "Failed to initialize thread_db on {0}", start.CommandLine);
+ }
+
+ int[] threads = inferior.GetThreads ();
+ foreach (int thread in threads) {
+ if (thread_hash.Contains (thread))
+ continue;
+ ThreadCreated (inferior, thread, Inferior.HasThreadEvents, resume_threads);
+ }
+
+ thread_db.GetThreadInfo (inferior, delegate (int lwp, long tid) {
+ SingleSteppingEngine engine = (SingleSteppingEngine) thread_hash [lwp];
+ if (engine == null) {
+ Report.Error ("Unknown thread {0} in {1}", lwp, start.CommandLine);
+ return;
+ }
+ engine.SetTID (tid);
+ });
+ }
+
+ public bool CheckForThreads(ArrayList check_threads)
+ {
+ if(thread_db == null)
+ return false;
+ thread_db.GetThreadInfo (null, delegate (int lwp, long tid) {
+ check_threads.Add(lwp);
+ } );
+ return true;
+ }
+
+ void get_thread_info (Inferior inferior, SingleSteppingEngine engine)
+ {
+ if (thread_db == null) {
+ if (mono_manager == null)
+ return;
+ Report.Error ("Failed to initialize thread_db on {0}: {1} {2}",
+ start.CommandLine, start, Environment.StackTrace);
+ throw new InternalError ();
+ }
+
+ bool found = false;
+ thread_db.GetThreadInfo (inferior, delegate (int lwp, long tid) {
+ if (lwp != engine.PID)
+ return;
+
+ engine.SetTID (tid);
+ found = true;
+ });
+
+ if (!found)
+ Report.Error ("Cannot find thread {0:x} in {1}",
+ engine.PID, start.CommandLine);
+ }
+
+ internal SingleSteppingEngine GetEngineByTID (Inferior inferior, long tid)
+ {
+ foreach (SingleSteppingEngine engine in thread_hash.Values) {
+ if (engine.TID == tid)
+ return engine;
+ }
+
+ if (thread_db == null) {
+ Report.Error ("Failed to initialize thread_db on {0}: {1}",
+ start.CommandLine, start);
+ return null;
+ }
+
+ SingleSteppingEngine result = null;
+ thread_db.GetThreadInfo (inferior, delegate (int t_lwp, long t_tid) {
+ if (tid != t_tid)
+ return;
+ result = (SingleSteppingEngine) thread_hash [t_lwp];
+
+ });
+
+ if (result == null)
+ Report.Error ("Cannot find thread {0:x} in {1}",
+ tid, start.CommandLine);
+
+ return result;
+ }
+
+ public void Kill ()
+ {
+ if (!Inferior.HasThreadEvents) {
+ SingleSteppingEngine[] sses = new SingleSteppingEngine [thread_hash.Count];
+ thread_hash.Values.CopyTo (sses, 0);
+ foreach (SingleSteppingEngine sse in sses)
+ sse.SetKilledFlag ();
+ foreach (SingleSteppingEngine sse in sses)
+ sse.Kill ();
+ } else {
+ main_thread.Kill ();
+ }
+ }
+
+ public void Detach ()
+ {
+ if (!CanDetach)
+ throw new TargetException (TargetError.CannotDetach);
+
+ main_thread.Detach ();
+ }
+
+ internal void OnTargetDetached ()
+ {
+ OnProcessExitedEvent ();
+ Dispose ();
+ }
+
+ internal MonoLanguageBackend CreateMonoLanguage (MonoDebuggerInfo info)
+ {
+ mono_language = new MonoLanguageBackend (this, info);
+ return mono_language;
+ }
+
+ internal void UpdateSymbolTable (TargetMemoryAccess target)
+ {
+ if (mono_language != null)
+ mono_language.Update (target);
+ }
+
+ public void LoadLibrary (Thread thread, string filename)
+ {
+ if (mono_language == null)
+ throw new SymbolTableException (
+ "Cannot load .NET assembly `{0}' while " +
+ "debugging an unmanaged application.",
+ filename);
+
+ if (!mono_language.TryFindImage (thread, filename))
+ throw new SymbolTableException ("Could not find any .NET assembly `{0}'.", filename);
+ }
+
+ internal MonoLanguageBackend MonoLanguage {
+ get {
+ if (mono_language == null)
+ throw new InvalidOperationException ();
+
+ return mono_language;
+ }
+ }
+
+ internal bool IsManagedApplication {
+ get { return mono_language != null; }
+ }
+
+ public Module[] Modules {
+ get { return session.Modules; }
+ }
+
+ public SourceLocation FindLocation (string file, int line)
+ {
+ foreach (Module module in Modules) {
+ SourceLocation location = module.FindLocation (file, line);
+
+ if (location != null)
+ return location;
+ }
+
+ return null;
+ }
+
+ public SourceLocation FindMethod (string name)
+ {
+ foreach (Module module in Modules) {
+ MethodSource method = module.FindMethod (name);
+
+ if (method != null)
+ return new SourceLocation (method);
+ }
+
+ return null;
+ }
+
+ internal ThreadServant[] ThreadServants {
+ get {
+ lock (thread_hash.SyncRoot) {
+ int count = thread_hash.Count;
+ ThreadServant[] servants = new ThreadServant [count];
+ thread_hash.Values.CopyTo (servants, 0);
+ return servants;
+ }
+ }
+ }
+
+ internal SingleSteppingEngine[] Engines {
+ get {
+ lock (thread_hash.SyncRoot) {
+ int count = thread_hash.Count;
+ SingleSteppingEngine[] engines = new SingleSteppingEngine [count];
+ thread_hash.Values.CopyTo (engines, 0);
+ return engines;
+ }
+ }
+ }
+
+ public TargetAddress LookupSymbol (string name)
+ {
+ return os.LookupSymbol (name);
+ }
+
+ public Thread[] GetThreads ()
+ {
+ lock (thread_hash.SyncRoot) {
+ int count = thread_hash.Count;
+ Thread[] threads = new Thread [count];
+ ThreadServant[] servants = new ThreadServant [count];
+ thread_hash.Values.CopyTo (servants, 0);
+ for (int i = 0; i < count; i++)
+ threads [i] = servants [i].Client;
+ return threads;
+ }
+ }
+
+ internal bool HasThreadLock {
+ get { return has_thread_lock; }
+ }
+
+ // <summary>
+ // Stop all currently running threads without sending any notifications.
+ // The threads are automatically resumed to their previos state when
+ // ReleaseGlobalThreadLock() is called.
+ // </summary>
+ internal void AcquireGlobalThreadLock (SingleSteppingEngine caller)
+ {
+ if (has_thread_lock)
+ throw new InternalError ("Recursive thread lock");
+
+ thread_lock_mutex.Lock ();
+ Report.Debug (DebugFlags.Threads,
+ "Acquiring global thread lock: {0}", caller);
+ has_thread_lock = true;
+ foreach (ThreadServant thread in thread_hash.Values) {
+ if (thread == caller)
+ continue;
+ thread.AcquireThreadLock ();
+ }
+ Report.Debug (DebugFlags.Threads,
+ "Done acquiring global thread lock: {0}",
+ caller);
+ }
+
+ internal void ReleaseGlobalThreadLock (SingleSteppingEngine caller)
+ {
+ Report.Debug (DebugFlags.Threads,
+ "Releasing global thread lock: {0}", caller);
+
+ foreach (ThreadServant thread in thread_hash.Values) {
+ if (thread == caller)
+ continue;
+ thread.ReleaseThreadLock ();
+ }
+ has_thread_lock = false;
+ thread_lock_mutex.Unlock ();
+ Report.Debug (DebugFlags.Threads,
+ "Released global thread lock: {0}", caller);
+ }
+
+ internal void DropGlobalThreadLock ()
+ {
+ if (thread_hash.Count != 0)
+ throw new InternalError ();
+
+ if (has_thread_lock) {
+ has_thread_lock = false;
+ thread_lock_mutex.Unlock ();
+ }
+ }
+
+#region User Threads
+
+ internal enum ProcessState
+ {
+ SingleThreaded,
+ Running,
+ Stopping,
+ Stopped,
+ Exited
+ }
+
+ protected ST.ManualResetEvent stopped_event;
+
+ ProcessState current_state = ProcessState.Stopped;
+ OperationCommandResult current_operation = null;
+
+ public void OperationCompleted (SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
+ {
+ if (!ThreadManager.InBackgroundThread && Inferior.HasThreadEvents)
+ throw new InternalError ();
+
+ if (current_state == ProcessState.Stopping)
+ return;
+ else if (current_state != ProcessState.Running)
+ throw new InternalError ();
+
+ if ((result != null) && (caller != main_thread) &&
+ ((result.Type == TargetEventType.TargetExited) || (result.Type == TargetEventType.TargetSignaled)))
+ return;
+
+ current_state = ProcessState.Stopping;
+ SuspendUserThreads (model, caller);
+
+ lock (this) {
+ current_state = ProcessState.Stopped;
+ current_operation.Completed ();
+ current_operation = null;
+ stopped_event.Set ();
+ }
+ }
+
+ protected void SuspendUserThreads (ThreadingModel model, SingleSteppingEngine caller)
+ {
+ Report.Debug (DebugFlags.Threads,
+ "Suspending user threads: {0} {1}", model, caller);
+
+ foreach (SingleSteppingEngine engine in thread_hash.Values) {
+ Report.Debug (DebugFlags.Threads, " check user thread: {0} {1}",
+ engine, engine.Thread.ThreadFlags);
+ if (engine == caller)
+ continue;
+ if (((engine.Thread.ThreadFlags & Thread.Flags.Immutable) != 0) &&
+ ((model & ThreadingModel.StopImmutableThreads) == 0))
+ continue;
+ if (((engine.Thread.ThreadFlags & Thread.Flags.Daemon) != 0) &&
+ ((model & ThreadingModel.StopDaemonThreads) == 0))
+ continue;
+ engine.SuspendUserThread ();
+ }
+
+ Report.Debug (DebugFlags.Threads,
+ "Done suspending user threads: {0} {1}", model, caller);
+ }
+
+ protected void ResumeUserThreads (ThreadingModel model, SingleSteppingEngine caller)
+ {
+ Report.Debug (DebugFlags.Threads,
+ "Resuming user threads: {0}", caller);
+
+ foreach (SingleSteppingEngine engine in thread_hash.Values) {
+ if (engine == caller)
+ continue;
+ if ((engine.Thread.ThreadFlags & Thread.Flags.AutoRun) == 0)
+ continue;
+ if (((engine.Thread.ThreadFlags & Thread.Flags.Immutable) != 0) &&
+ ((model & ThreadingModel.StopImmutableThreads) == 0))
+ continue;
+ if (((engine.Thread.ThreadFlags & Thread.Flags.Daemon) != 0) &&
+ ((model & ThreadingModel.StopDaemonThreads) == 0))
+ continue;
+
+ CommandResult result;
+ if (current_operation != null)
+ result = current_operation;
+ else
+ result = new ThreadCommandResult (engine.Thread);
+
+ engine.ResumeUserThread (result);
+ }
+
+ Report.Debug (DebugFlags.Threads,
+ "Resumed user threads: {0}", caller);
+ }
+
+ internal CommandResult StartOperation (ThreadingModel model, SingleSteppingEngine caller)
+ {
+ if (!ThreadManager.InBackgroundThread)
+ throw new InternalError ();
+
+ if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
+ throw new TargetException (TargetError.NotStopped);
+
+ if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Single) {
+ current_state = ProcessState.SingleThreaded;
+ if ((model & ThreadingModel.ResumeThreads) != 0)
+ ResumeUserThreads (model, caller);
+ return new ThreadCommandResult (caller.Thread);
+ } else if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Process) {
+ throw new ArgumentException ();
+ }
+
+ lock (this) {
+ current_state = ProcessState.Running;
+ stopped_event.Reset ();
+ current_operation = new ProcessCommandResult (this, model);
+ }
+
+ ResumeUserThreads (model, caller);
+ return current_operation;
+ }
+
+ internal void StartGlobalOperation (ThreadingModel model, SingleSteppingEngine caller, OperationCommandResult operation)
+ {
+ if (!ThreadManager.InBackgroundThread)
+ throw new InternalError ();
+
+ if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
+ throw new TargetException (TargetError.NotStopped);
+
+ lock (this) {
+ current_state = ProcessState.Running;
+ stopped_event.Reset ();
+ current_operation = operation;
+ }
+
+ ResumeUserThreads (model, caller);
+ }
+
+ protected CommandResult CloneParentOperation (SingleSteppingEngine new_thread)
+ {
+ if (parent.current_state == ProcessState.SingleThreaded) {
+ current_state = ProcessState.SingleThreaded;
+ return new ThreadCommandResult (new_thread.Thread);
+ }
+
+ if (parent.current_state != ProcessState.Running)
+ throw new InternalError ();
+
+ current_state = ProcessState.Running;
+ if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Global)
+ current_operation = parent.current_operation;
+ else if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Process)
+ current_operation = new ProcessCommandResult (this, parent.current_operation.ThreadingModel);
+ else
+ throw new InternalError ();
+
+ return current_operation;
+ }
+
+ internal void Stop ()
+ {
+ main_thread.Invoke (delegate {
+ current_state = ProcessState.Stopping;
+
+ SuspendUserThreads (ThreadingModel.Process, null);
+ current_state = ProcessState.Stopped;
+ if (current_operation != null) {
+ current_operation.Completed ();
+ current_operation = null;
+ }
+ stopped_event.Set ();
+ return null;
+ }, null);
+ }
+
+ ST.WaitHandle IOperationHost.WaitHandle {
+ get { return stopped_event; }
+ }
+
+ void IOperationHost.SendResult (SingleSteppingEngine sse, TargetEventArgs args)
+ {
+ Debugger.SendTargetEvent (sse, args);
+ }
+
+ void IOperationHost.Abort ()
+ {
+ Stop ();
+ }
+
+ protected class ProcessCommandResult : OperationCommandResult
+ {
+ public ProcessServant Process {
+ get; private set;
+ }
+
+ internal override IOperationHost Host {
+ get { return Process; }
+ }
+
+ internal ProcessCommandResult (ProcessServant process, ThreadingModel model)
+ : base (model)
+ {
+ this.Process = process;
+ }
+
+ internal override void OnExecd (SingleSteppingEngine new_thread)
+ {
+ Process = new_thread.Process;
+ }
+ }
+
+#endregion
+
+ public bool ActivatePendingBreakpoints (CommandResult result)
+ {
+ return ((SingleSteppingEngine) main_thread).ManagedCallback (
+ delegate (SingleSteppingEngine sse) {
+ return sse.ActivatePendingBreakpoints (null);
+ }, result);
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("{0} ({1})", GetType (), ID);
+ }
+
+ //
+ // IDisposable
+ //
+
+ private bool disposed = false;
+
+ private void check_disposed ()
+ {
+ if (disposed)
+ throw new ObjectDisposedException ("Process");
+ }
+
+ protected virtual void DoDispose ()
+ {
+ if (!is_forked) {
+ if (architecture != null) {
+ architecture.Dispose ();
+ architecture = null;
+ }
+
+ if (mono_language != null) {
+ mono_language.Dispose();
+ mono_language = null;
+ }
+
+ if (native_language != null) {
+ native_language.Dispose ();
+ native_language = null;
+ }
+
+ if (os != null) {
+ os.Dispose ();
+ os = null;
+ }
+
+ if (symtab_manager != null) {
+ symtab_manager.Dispose ();
+ symtab_manager = null;
+ }
+ }
+
+ if (breakpoint_manager != null) {
+ breakpoint_manager.Dispose ();
+ breakpoint_manager = null;
+ }
+
+ if (thread_db != null) {
+ thread_db.Dispose ();
+ thread_db = null;
+ }
+
+ if (thread_lock_mutex != null) {
+ thread_lock_mutex.Dispose ();
+ thread_lock_mutex = null;
+ }
+
+ exception_handlers = null;
+
+ manager.RemoveProcess (this);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ // Check to see if Dispose has already been called.
+ lock (this) {
+ if (disposed)
+ return;
+
+ disposed = true;
+ }
+
+ // If this is a call to Dispose, dispose all managed resources.
+ if (disposing)
+ DoDispose ();
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ // Take yourself off the Finalization queue
+ GC.SuppressFinalize (this);
+ }
+
+ ~ProcessServant ()
+ {
+ Dispose (false);
+ }
+ }
+}
diff --git a/backend/SingleSteppingEngine.cs b/backend/SingleSteppingEngine.cs
index aae1f88..9204f12 100644
--- a/backend/SingleSteppingEngine.cs
+++ b/backend/SingleSteppingEngine.cs
@@ -80,14 +80,14 @@ namespace Mono.Debugger.Backend
internal delegate bool TrampolineHandler (Method method);
internal delegate bool CheckBreakpointHandler ();
- protected SingleSteppingEngine (ThreadManager manager, Process process)
+ protected SingleSteppingEngine (ThreadManager manager, ProcessServant process)
: base (manager, process)
{
Report.Debug (DebugFlags.Threads, "New SSE ({0}): {1}",
DebuggerWaitHandle.CurrentThread, this);
}
- public SingleSteppingEngine (ThreadManager manager, Process process,
+ public SingleSteppingEngine (ThreadManager manager, ProcessServant process,
ProcessStart start)
: this (manager, process)
{
@@ -103,7 +103,7 @@ namespace Mono.Debugger.Backend
manager.AddEngine (this);
}
- public SingleSteppingEngine (ThreadManager manager, Process process,
+ public SingleSteppingEngine (ThreadManager manager, ProcessServant process,
Inferior inferior, int pid)
: this (manager, process)
{
@@ -146,11 +146,6 @@ namespace Mono.Debugger.Backend
return result;
}
- public void StartSuspended ()
- {
- frame_changed (inferior.CurrentFrame, null);
- }
-
#region child event processing
// <summary>
// This is called from the SingleSteppingEngine's main event loop to give
@@ -224,7 +219,7 @@ namespace Mono.Debugger.Backend
}
}
- if (Process.IsAttached && !attach_initialized) {
+ if (ProcessServant.IsAttached && !attach_initialized) {
attach_initialized = true;
if (cevent.Type == Inferior.ChildEventType.CHILD_INTERRUPTED)
@@ -290,7 +285,7 @@ namespace Mono.Debugger.Backend
InterruptibleOperation io = nested_break_stack.Pop ();
if (io != rti)
throw new InternalError ("{0} unexpected item on nested break state stack: {1}", this, io);
- process.Debugger.OnLeaveNestedBreakState (thread);
+ process.Debugger.OnLeaveNestedBreakState (this);
}
if (current_operation != rti) {
@@ -612,7 +607,7 @@ namespace Mono.Debugger.Backend
InterruptibleOperation io = nested_break_stack.Pop ();
if (io != rti)
throw new InternalError ("{0} aborting rti failed: {1}", this, io);
- process.Debugger.OnLeaveNestedBreakState (thread);
+ process.Debugger.OnLeaveNestedBreakState (this);
}
return rti;
@@ -643,7 +638,7 @@ namespace Mono.Debugger.Backend
operation_completed_event.Set ();
if (suspended) {
- process.Debugger.OnEnterNestedBreakState (thread);
+ process.Debugger.OnEnterNestedBreakState (this);
((InterruptibleOperation) current_operation).IsSuspended = true;
nested_break_stack.Push ((InterruptibleOperation) current_operation);
current_operation.CompletedOperation (true);
@@ -714,7 +709,7 @@ namespace Mono.Debugger.Backend
if (current_operation != null)
OperationCompleted (result);
else
- process.Debugger.OnTargetEvent (thread, result);
+ process.Debugger.SendTargetEvent (this, result);
process.OnThreadExitedEvent (this);
Dispose ();
@@ -903,6 +898,10 @@ namespace Mono.Debugger.Backend
get { return operation_completed_event; }
}
+ internal override ProcessServant ProcessServant {
+ get { return process; }
+ }
+
internal override ThreadManager ThreadManager {
get { return manager; }
}
@@ -1024,7 +1023,7 @@ namespace Mono.Debugger.Backend
if (current_operation != null)
OperationCompleted (result);
else
- process.Debugger.OnTargetEvent (thread, result);
+ process.Debugger.SendTargetEvent (this, result);
process.OnThreadExitedEvent (this);
Dispose ();
@@ -1177,7 +1176,7 @@ namespace Mono.Debugger.Backend
Report.Debug (DebugFlags.SSE, "{0} throwing exception: {1}", this, exc_obj.Type.Name);
ExceptionAction action;
- if (process.GenericExceptionCatchPoint (exc_obj.Type.Name, out action)) {
+ if (process.Client.GenericExceptionCatchPoint (exc_obj.Type.Name, out action)) {
Report.Debug (DebugFlags.SSE,
"{0} generic exception catchpoint: {1}", this, action);
return action;
@@ -2006,7 +2005,7 @@ namespace Mono.Debugger.Backend
frame_changed (inferior.CurrentFrame, null);
TargetEventArgs args = new TargetEventArgs (
TargetEventType.TargetStopped, 0, current_frame);
- process.Debugger.OnTargetEvent (thread, args);
+ process.Debugger.SendTargetEvent (this, args);
return null;
}
@@ -2959,10 +2958,10 @@ namespace Mono.Debugger.Backend
protected override void DoExecute ()
{
Report.Debug (DebugFlags.SSE,
- "{0} execute start: {1} {2} {3}", sse, sse.Process.IsAttached,
+ "{0} execute start: {1} {2} {3}", sse, sse.ProcessServant.IsAttached,
inferior.CurrentFrame, inferior.EntryPoint);
- if (!sse.Process.IsAttached && Inferior.HasThreadEvents)
+ if (!sse.ProcessServant.IsAttached && Inferior.HasThreadEvents)
sse.do_continue (inferior.EntryPoint);
else
sse.ProcessEvent (new Inferior.ChildEvent (Inferior.ChildEventType.CHILD_STOPPED, 0, 0, 0));
@@ -2973,7 +2972,7 @@ namespace Mono.Debugger.Backend
{
Report.Debug (DebugFlags.SSE,
"{0} start: {1} {2} {3} {4}", sse,
- cevent, sse.Process.IsAttached,
+ cevent, sse.ProcessServant.IsAttached,
inferior.CurrentFrame, inferior.EntryPoint);
args = null;
@@ -2989,13 +2988,13 @@ namespace Mono.Debugger.Backend
return EventResult.Running;
}
- sse.Process.OperatingSystem.UpdateSharedLibraries (inferior);
- sse.Process.InitializeThreads (inferior, !sse.Process.IsAttached);
+ sse.ProcessServant.OperatingSystem.UpdateSharedLibraries (inferior);
+ sse.ProcessServant.InitializeThreads (inferior, !sse.ProcessServant.IsAttached);
- if (sse.Process.IsAttached)
+ if (sse.ProcessServant.IsAttached)
return EventResult.Completed;
- if (!sse.Process.IsManaged) {
+ if (!sse.ProcessServant.IsManaged) {
if (sse.InitializeBreakpoints ())
return EventResult.Running;
}
@@ -3099,7 +3098,7 @@ namespace Mono.Debugger.Backend
protected override void DoExecute ()
{
- MonoDebuggerInfo info = sse.Process.MonoManager.MonoDebuggerInfo;
+ MonoDebuggerInfo info = sse.ProcessServant.MonoManager.MonoDebuggerInfo;
MonoFunctionType func = (MonoFunctionType) Handle.Function;
TargetAddress image = func.SymbolFile.MonoImage;
@@ -3142,7 +3141,7 @@ namespace Mono.Debugger.Backend
protected override void DoExecute ()
{
- MonoDebuggerInfo info = sse.Process.MonoManager.MonoDebuggerInfo;
+ MonoDebuggerInfo info = sse.ProcessServant.MonoManager.MonoDebuggerInfo;
Report.Debug (DebugFlags.SSE,
"{0} remove breakpoint: {1} {2}", sse, Handle, Handle.Index);
@@ -3181,7 +3180,7 @@ namespace Mono.Debugger.Backend
"{0} init after fork ({1})", sse,
DebuggerWaitHandle.CurrentThread);
- sse.Process.BreakpointManager.InitializeAfterFork (inferior);
+ sse.ProcessServant.BreakpointManager.InitializeAfterFork (inferior);
args = null;
return EventResult.AskParent;
@@ -3200,7 +3199,7 @@ namespace Mono.Debugger.Backend
protected override void DoExecute ()
{
- MonoDebuggerInfo info = sse.Process.MonoManager.MonoDebuggerInfo;
+ MonoDebuggerInfo info = sse.ProcessServant.MonoManager.MonoDebuggerInfo;
inferior.CallMethod (info.InitCodeBuffer, 0, 0, ID);
}
@@ -3345,7 +3344,7 @@ namespace Mono.Debugger.Backend
"{0} executing instruction: {1}", sse,
TargetBinaryReader.HexDump (Instruction));
- if (!sse.Process.MonoManager.HasCodeBuffer) {
+ if (!sse.ProcessServant.MonoManager.HasCodeBuffer) {
sse.PushOperation (new OperationInitCodeBuffer (sse));
pushed_code_buffer = true;
return;
@@ -4784,7 +4783,7 @@ namespace Mono.Debugger.Backend
protected override void DoExecute ()
{
try {
- exc_object = sse.Process.MonoLanguage.CreateObject (inferior, exc);
+ exc_object = sse.ProcessServant.MonoLanguage.CreateObject (inferior, exc);
} catch {
exc_object = null;
}
diff --git a/backend/ThreadDB.cs b/backend/ThreadDB.cs
index 7612c9a..ca4f72e 100644
--- a/backend/ThreadDB.cs
+++ b/backend/ThreadDB.cs
@@ -6,7 +6,7 @@ namespace Mono.Debugger.Backend
internal class ThreadDB : DebuggerMarshalByRefObject
{
IntPtr handle;
- Process process;
+ ProcessServant process;
TargetMemoryAccess target;
DebuggerMutex mutex;
@@ -43,7 +43,7 @@ namespace Mono.Debugger.Backend
ReadMemoryFunc read_memory_func;
WriteMemoryFunc write_memory_func;
- protected ThreadDB (Process process)
+ protected ThreadDB (ProcessServant process)
{
this.process = process;
@@ -71,7 +71,7 @@ namespace Mono.Debugger.Backend
}
}
- public static ThreadDB Create (Process process, Inferior target)
+ public static ThreadDB Create (ProcessServant process, Inferior target)
{
ThreadDB db = new ThreadDB (process);
if (!db.Initialize (target))
diff --git a/backend/ThreadManager.cs b/backend/ThreadManager.cs
index 595d8a1..4280fd2 100644
--- a/backend/ThreadManager.cs
+++ b/backend/ThreadManager.cs
@@ -21,9 +21,9 @@ namespace Mono.Debugger.Backend
{
public static TimeSpan WaitTimeout = TimeSpan.FromMilliseconds (5000);
- internal ThreadManager (Debugger debugger)
+ internal ThreadManager (DebuggerServant backend)
{
- this.debugger = debugger;
+ this.backend = backend;
thread_hash = Hashtable.Synchronized (new Hashtable ());
engine_hash = Hashtable.Synchronized (new Hashtable ());
@@ -36,6 +36,9 @@ namespace Mono.Debugger.Backend
address_domain = AddressDomain.Global;
+ command_mutex = new DebuggerMutex ("command_mutex");
+ command_mutex.DebugFlags = DebugFlags.Wait;
+
wait_event = new ST.AutoResetEvent (false);
engine_event = new ST.ManualResetEvent (true);
ready_event = new ST.ManualResetEvent (false);
@@ -56,7 +59,7 @@ namespace Mono.Debugger.Backend
ready_event.WaitOne ();
}
- Debugger debugger;
+ DebuggerServant backend;
DebuggerEventQueue event_queue;
ST.Thread inferior_thread;
ST.Thread wait_thread;
@@ -73,6 +76,7 @@ namespace Mono.Debugger.Backend
DateTime last_pending_sigstop;
Dictionary<int,DateTime> pending_sigstops;
+ DebuggerMutex command_mutex;
bool abort_requested;
bool waiting;
@@ -83,6 +87,9 @@ namespace Mono.Debugger.Backend
static extern int mono_debugger_server_global_wait (out int status);
[DllImport("monodebuggerserver")]
+ static extern int mono_debugger_server_get_pending_sigint ();
+
+ [DllImport("monodebuggerserver")]
static extern Inferior.ChildEventType mono_debugger_server_dispatch_simple (int status, out int arg);
void start_inferior ()
@@ -93,8 +100,6 @@ namespace Mono.Debugger.Backend
while (!abort_requested) {
engine_thread_main ();
}
-
- Report.Debug (DebugFlags.Threads, "Engine thread exiting.");
}
// <remarks>
@@ -105,14 +110,12 @@ namespace Mono.Debugger.Backend
SingleSteppingEngine current_event = null;
int current_event_status = 0;
-#if DISABLED
- public Process OpenCoreFile (ProcessStart start, out Thread[] threads)
+ public ProcessServant OpenCoreFile (ProcessStart start, out Thread[] threads)
{
CoreFile core = CoreFile.OpenCoreFile (this, start);
threads = core.GetThreads ();
return core;
}
-#endif
internal void AddEngine (SingleSteppingEngine engine)
{
@@ -120,7 +123,7 @@ namespace Mono.Debugger.Backend
engine_hash.Add (engine.ID, engine);
}
- internal void RemoveProcess (Process process)
+ internal void RemoveProcess (ProcessServant process)
{
processes.Remove (process);
}
@@ -218,8 +221,8 @@ namespace Mono.Debugger.Backend
return true;
}
- public Debugger Debugger {
- get { return debugger; }
+ public DebuggerServant Debugger {
+ get { return backend; }
}
public AddressDomain AddressDomain {
@@ -254,7 +257,7 @@ namespace Mono.Debugger.Backend
return command.Result;
}
- public Process StartApplication (ProcessStart start, out CommandResult result)
+ public ProcessServant StartApplication (ProcessStart start, out CommandResult result)
{
Command command = new Command (CommandType.CreateProcess, start);
@@ -274,7 +277,7 @@ namespace Mono.Debugger.Backend
if (command.Result is Exception)
throw (Exception) command.Result;
else {
- var pair = (KeyValuePair<CommandResult,Process>) command.Result;
+ var pair = (KeyValuePair<CommandResult,ProcessServant>) command.Result;
result = pair.Key;
return pair.Value;
}
@@ -370,14 +373,14 @@ namespace Mono.Debugger.Backend
} else if (command.Type == CommandType.CreateProcess) {
try {
ProcessStart start = (ProcessStart) command.Data1;
- Process process = new Process (this, start);
+ ProcessServant process = new ProcessServant (this, start);
processes.Add (process);
CommandResult result = process.StartApplication ();
RequestWait ();
- command.Result = new KeyValuePair<CommandResult,Process> (result, process);
+ command.Result = new KeyValuePair<CommandResult,ProcessServant> (result, process);
} catch (ST.ThreadAbortException) {
return;
} catch (Exception ex) {
@@ -471,17 +474,12 @@ namespace Mono.Debugger.Backend
//
do {
- Report.Debug (DebugFlags.Wait,
- "Wait thread reaping children");
pid = mono_debugger_server_global_wait (out status);
Report.Debug (DebugFlags.Wait,
"Wait thread received event: {0} {1:x}",
pid, status);
} while (pid > 0);
- Report.Debug (DebugFlags.Wait,
- "Wait thread done");
-
return false;
}
@@ -543,7 +541,7 @@ namespace Mono.Debugger.Backend
ArrayList check_threads = new ArrayList();
bool got_threads = true;
- foreach(Process process in processes)
+ foreach(ProcessServant process in processes)
got_threads = got_threads && process.CheckForThreads(check_threads);
if(got_threads) {
@@ -554,7 +552,7 @@ namespace Mono.Debugger.Backend
SingleSteppingEngine old_engine = (SingleSteppingEngine) thread_hash [lwp];
thread_hash.Remove (old_engine.PID);
engine_hash.Remove (old_engine.ID);
- old_engine.Process.OnThreadExitedEvent (old_engine);
+ old_engine.ProcessServant.OnThreadExitedEvent (old_engine);
old_engine.Dispose ();
}
}
@@ -663,10 +661,7 @@ namespace Mono.Debugger.Backend
#if FIXME
RequestWait ();
#endif
- if (event_queue.TryLock ()) {
- event_queue.Signal();
- event_queue.Unlock ();
- }
+ event_queue.Signal();
disposed = true;
}
@@ -715,7 +710,7 @@ namespace Mono.Debugger.Backend
wait_thread.Abort ();
wait_thread.Join ();
- Process[] procs = new Process [processes.Count];
+ ProcessServant[] procs = new ProcessServant [processes.Count];
processes.CopyTo (procs, 0);
for (int i = 0; i < procs.Length; i++)
diff --git a/backend/ThreadServant.cs b/backend/ThreadServant.cs
index ce9421a..d4da572 100644
--- a/backend/ThreadServant.cs
+++ b/backend/ThreadServant.cs
@@ -17,7 +17,7 @@ namespace Mono.Debugger.Backend
{
internal abstract class ThreadServant : DebuggerMarshalByRefObject
{
- protected ThreadServant (ThreadManager manager, Process process)
+ protected ThreadServant (ThreadManager manager, ProcessServant process)
{
this.manager = manager;
this.process = process;
@@ -27,12 +27,12 @@ namespace Mono.Debugger.Backend
tgroup = process.Session.CreateThreadGroup ("@" + ID);
tgroup.AddThread (ID);
- thread = process.Debugger.CreateThread (this, ID);
+ thread = process.Debugger.Client.CreateThread (this, ID);
}
protected readonly int id;
protected readonly Thread thread;
- protected readonly Process process;
+ protected readonly ProcessServant process;
protected readonly ThreadManager manager;
protected readonly ThreadGroup tgroup;
@@ -78,7 +78,11 @@ namespace Mono.Debugger.Backend
get;
}
- internal Process Process {
+ internal abstract ProcessServant ProcessServant {
+ get;
+ }
+
+ internal ProcessServant Process {
get { return process; }
}
diff --git a/backend/arch/Architecture.cs b/backend/arch/Architecture.cs
index 02fdd2d..c25622e 100644
--- a/backend/arch/Architecture.cs
+++ b/backend/arch/Architecture.cs
@@ -9,13 +9,13 @@ namespace Mono.Debugger.Backend
// </summary>
internal abstract class Architecture : DebuggerMarshalByRefObject, IDisposable
{
- protected readonly Process process;
+ protected readonly ProcessServant process;
protected readonly TargetInfo TargetInfo;
Disassembler disassembler;
X86_Opcodes opcodes;
- protected Architecture (Process process, TargetInfo info)
+ protected Architecture (ProcessServant process, TargetInfo info)
{
this.process = process;
this.TargetInfo = info;
diff --git a/backend/arch/Architecture_I386.cs b/backend/arch/Architecture_I386.cs
index 683f0cd..a5a2292 100644
--- a/backend/arch/Architecture_I386.cs
+++ b/backend/arch/Architecture_I386.cs
@@ -9,7 +9,7 @@ namespace Mono.Debugger.Architectures
// </summary>
internal class Architecture_I386 : X86_Architecture
{
- internal Architecture_I386 (Process process, TargetInfo info)
+ internal Architecture_I386 (ProcessServant process, TargetInfo info)
: base (process, info)
{ }
diff --git a/backend/arch/Architecture_X86_64.cs b/backend/arch/Architecture_X86_64.cs
index 1153a2a..0a28d10 100644
--- a/backend/arch/Architecture_X86_64.cs
+++ b/backend/arch/Architecture_X86_64.cs
@@ -12,7 +12,7 @@ namespace Mono.Debugger.Architectures
protected const int MONO_FAKE_IMT_METHOD = -1;
protected const int MONO_FAKE_VTABLE_METHOD = -2;
- internal Architecture_X86_64 (Process process, TargetInfo info)
+ internal Architecture_X86_64 (ProcessServant process, TargetInfo info)
: base (process, info)
{ }
diff --git a/backend/arch/CoreFile.cs b/backend/arch/CoreFile.cs
index 7e41d3f..a052300 100644
--- a/backend/arch/CoreFile.cs
+++ b/backend/arch/CoreFile.cs
@@ -1,4 +1,3 @@
-#if DISABLED
using System;
using System.IO;
using System.Collections;
@@ -11,7 +10,7 @@ using Mono.Debugger.Backend.Mono;
namespace Mono.Debugger.Backend
{
- internal class CoreFile : Process
+ internal class CoreFile : ProcessServant
{
TargetMemoryInfo info;
Bfd bfd, core_bfd;
@@ -267,7 +266,7 @@ namespace Mono.Debugger.Backend
get { return CoreFile.ThreadManager; }
}
- internal override Process Process {
+ internal override ProcessServant ProcessServant {
get { return CoreFile; }
}
@@ -724,4 +723,3 @@ namespace Mono.Debugger.Backend
}
}
}
-#endif
diff --git a/backend/arch/Makefile.in b/backend/arch/Makefile.in
index 81a680c..8fe7019 100644
--- a/backend/arch/Makefile.in
+++ b/backend/arch/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/backend/arch/Opcodes_I386.cs b/backend/arch/Opcodes_I386.cs
index 7ccfedf..fda5623 100644
--- a/backend/arch/Opcodes_I386.cs
+++ b/backend/arch/Opcodes_I386.cs
@@ -5,7 +5,7 @@ namespace Mono.Debugger.Architectures
{
internal class Opcodes_I386 : X86_Opcodes
{
- internal Opcodes_I386 (Process process)
+ internal Opcodes_I386 (ProcessServant process)
: base (process)
{ }
diff --git a/backend/arch/Opcodes_X86_64.cs b/backend/arch/Opcodes_X86_64.cs
index 7c90715..c867cf8 100644
--- a/backend/arch/Opcodes_X86_64.cs
+++ b/backend/arch/Opcodes_X86_64.cs
@@ -5,7 +5,7 @@ namespace Mono.Debugger.Architectures
{
internal class Opcodes_X86_64 : X86_Opcodes
{
- internal Opcodes_X86_64 (Process process)
+ internal Opcodes_X86_64 (ProcessServant process)
: base (process)
{ }
diff --git a/backend/arch/X86_Architecture.cs b/backend/arch/X86_Architecture.cs
index 5b61e6b..0469dc4 100644
--- a/backend/arch/X86_Architecture.cs
+++ b/backend/arch/X86_Architecture.cs
@@ -45,7 +45,7 @@ namespace Mono.Debugger.Architectures
internal abstract class X86_Architecture : Architecture
{
- protected X86_Architecture (Process process, TargetInfo info)
+ protected X86_Architecture (ProcessServant process, TargetInfo info)
: base (process, info)
{ }
diff --git a/backend/arch/X86_Instruction.cs b/backend/arch/X86_Instruction.cs
index 791a411..60ceb50 100644
--- a/backend/arch/X86_Instruction.cs
+++ b/backend/arch/X86_Instruction.cs
@@ -533,7 +533,7 @@ namespace Mono.Debugger.Architectures
}
bool is_start;
- if (Opcodes.Process.OperatingSystem.GetTrampoline (
+ if (Opcodes.Process.NativeLanguage.OperatingSystem.GetTrampoline (
memory, target, out trampoline, out is_start)) {
target = trampoline;
return is_start ?
diff --git a/backend/arch/X86_Opcodes.cs b/backend/arch/X86_Opcodes.cs
index faa5b79..0c64164 100644
--- a/backend/arch/X86_Opcodes.cs
+++ b/backend/arch/X86_Opcodes.cs
@@ -7,11 +7,11 @@ namespace Mono.Debugger.Architectures
{
internal abstract class X86_Opcodes : Opcodes
{
- Process process;
+ ProcessServant process;
TargetMemoryInfo target_info;
Disassembler disassembler;
- protected X86_Opcodes (Process process)
+ protected X86_Opcodes (ProcessServant process)
{
this.process = process;
@@ -32,7 +32,7 @@ namespace Mono.Debugger.Architectures
get { return disassembler; }
}
- internal Process Process {
+ internal ProcessServant Process {
get { return process; }
}
diff --git a/backend/mono/Makefile.in b/backend/mono/Makefile.in
index fa7ca51..b5861b1 100644
--- a/backend/mono/Makefile.in
+++ b/backend/mono/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/backend/mono/MonoLanguageBackend.cs b/backend/mono/MonoLanguageBackend.cs
index fc9b06d..ab12566 100644
--- a/backend/mono/MonoLanguageBackend.cs
+++ b/backend/mono/MonoLanguageBackend.cs
@@ -90,21 +90,21 @@ namespace Mono.Debugger.Backend.Mono
DecimalType = MonoFundamentalType.Create (
corlib, memory, FundamentalKind.Decimal);
- Cecil.TypeDefinition decimal_type = corlib.ModuleDefinition.GetType ("System.Decimal");
+ Cecil.TypeDefinition decimal_type = corlib.ModuleDefinition.Types ["System.Decimal"];
corlib.AddType (decimal_type, DecimalType);
TargetAddress klass = corlib.MonoLanguage.MetadataHelper.GetArrayClass (memory);
- Cecil.TypeDefinition array_type = corlib.ModuleDefinition.GetType ("System.Array");
+ Cecil.TypeDefinition array_type = corlib.ModuleDefinition.Types ["System.Array"];
ArrayType = mono.CreateCoreType (corlib, array_type, memory, klass);
mono.AddCoreType (array_type, ArrayType, ArrayType, klass);
klass = corlib.MonoLanguage.MetadataHelper.GetDelegateClass (memory);
- Cecil.TypeDefinition delegate_type = corlib.ModuleDefinition.GetType ("System.Delegate");
+ Cecil.TypeDefinition delegate_type = corlib.ModuleDefinition.Types ["System.Delegate"];
DelegateType = new MonoClassType (corlib, delegate_type);
mono.AddCoreType (delegate_type, DelegateType, DelegateType, klass);
klass = corlib.MonoLanguage.MetadataHelper.GetExceptionClass (memory);
- Cecil.TypeDefinition exception_type = corlib.ModuleDefinition.GetType ("System.Exception");
+ Cecil.TypeDefinition exception_type = corlib.ModuleDefinition.Types ["System.Exception"];
ExceptionType = mono.CreateCoreType (corlib, exception_type, memory, klass);
mono.AddCoreType (exception_type, ExceptionType, ExceptionType, klass);
}
@@ -225,12 +225,12 @@ namespace Mono.Debugger.Backend.Mono
MetadataHelper runtime;
- Process process;
+ ProcessServant process;
MonoDebuggerInfo info;
TargetAddress[] trampolines;
bool initialized;
- public MonoLanguageBackend (Process process, MonoDebuggerInfo info)
+ public MonoLanguageBackend (ProcessServant process, MonoDebuggerInfo info)
{
this.process = process;
this.info = info;
@@ -257,7 +257,7 @@ namespace Mono.Debugger.Backend.Mono
get { return builtin_types; }
}
- internal override Process Process {
+ internal override ProcessServant Process {
get { return process; }
}
@@ -289,7 +289,7 @@ namespace Mono.Debugger.Backend.Mono
internal bool TryFindImage (Thread thread, string filename)
{
- Cecil.AssemblyDefinition ass = Cecil.AssemblyDefinition.ReadAssembly (filename);
+ Cecil.AssemblyDefinition ass = Cecil.AssemblyFactory.GetAssembly (filename);
if (ass == null)
return false;
@@ -325,7 +325,7 @@ namespace Mono.Debugger.Backend.Mono
return new MonoArrayType (element_type, array.Rank);
}
- Cecil.ByReferenceType reftype = type as Cecil.ByReferenceType;
+ Cecil.ReferenceType reftype = type as Cecil.ReferenceType;
if (reftype != null) {
TargetType element_type = LookupMonoType (reftype.ElementType);
if (element_type == null)
@@ -407,7 +407,7 @@ namespace Mono.Debugger.Backend.Mono
Cecil.TypeDefinition resolve_cecil_type_ref (Cecil.TypeReference type)
{
- type = type.GetElementType ();
+ type = type.GetOriginalType ();
if (type is Cecil.TypeDefinition)
return (Cecil.TypeDefinition) type;
@@ -418,12 +418,12 @@ namespace Mono.Debugger.Backend.Mono
if (assembly == null)
return null;
- return assembly.MainModule.GetType (type.FullName);
+ return assembly.MainModule.Types [type.FullName];
}
Cecil.ModuleDefinition module = type.Scope as Cecil.ModuleDefinition;
if (module != null)
- return module.GetType (type.FullName);
+ return module.Types [type.FullName];
throw new NotImplementedException ();
}
@@ -1075,7 +1075,7 @@ namespace Mono.Debugger.Backend.Mono
foreach (MonoSymbolFile symfile in symfile_by_index.Values) {
try {
- var types = symfile.Assembly.MainModule.Types;
+ Cecil.TypeDefinitionCollection types = symfile.Assembly.MainModule.Types;
// FIXME: Work around an API problem in Cecil.
foreach (Cecil.TypeDefinition type in types) {
if (type.FullName != name)
@@ -1402,7 +1402,7 @@ namespace Mono.Debugger.Backend.Mono
"Module load: {0} {1}", data, symfile);
if (symfile == null)
break;
- engine.Process.Debugger.OnModuleLoadedEvent (symfile.Module);
+ engine.Process.Debugger.OnModuleLoaded (symfile.Module);
if ((builtin_types != null) && (symfile != null)) {
if (engine.OnModuleLoaded (symfile.Module))
return false;
@@ -1418,7 +1418,7 @@ namespace Mono.Debugger.Backend.Mono
if (symfile == null)
break;
- engine.Process.Debugger.OnModuleUnLoadedEvent (symfile.Module);
+ engine.Process.Debugger.OnModuleUnLoaded (symfile.Module);
close_symfile (symfile);
break;
}
diff --git a/backend/mono/MonoSymbolFile.cs b/backend/mono/MonoSymbolFile.cs
index 0529e78..0158f56 100644
--- a/backend/mono/MonoSymbolFile.cs
+++ b/backend/mono/MonoSymbolFile.cs
@@ -182,7 +182,7 @@ namespace Mono.Debugger.Backend.Mono
internal readonly TargetMemoryInfo TargetMemoryInfo;
internal readonly MonoLanguageBackend MonoLanguage;
internal readonly Architecture Architecture;
- protected readonly Process process;
+ protected readonly ProcessServant process;
MonoSymbolTable symtab;
Module module;
string name;
@@ -196,7 +196,7 @@ namespace Mono.Debugger.Backend.Mono
Dictionary<C.SourceFileEntry,SourceFile> source_file_hash;
Hashtable method_index_hash;
- internal MonoSymbolFile (MonoLanguageBackend language, Process process,
+ internal MonoSymbolFile (MonoLanguageBackend language, ProcessServant process,
TargetMemoryAccess memory, TargetAddress address)
{
this.MonoLanguage = language;
@@ -231,7 +231,7 @@ namespace Mono.Debugger.Backend.Mono
ImageFile = shadow_location;
try {
- Assembly = Cecil.AssemblyDefinition.ReadAssembly (ImageFile);
+ Assembly = Cecil.AssemblyFactory.GetAssembly (ImageFile);
} catch (Exception ex) {
throw new SymbolTableException (
"Cannot load symbol file `{0}': {1}", ImageFile, ex);
@@ -244,7 +244,7 @@ namespace Mono.Debugger.Backend.Mono
string mdb_file = ImageFile + ".mdb";
try {
- File = C.MonoSymbolFile.ReadSymbolFile (ModuleDefinition, mdb_file);
+ File = C.MonoSymbolFile.ReadSymbolFile (Assembly, mdb_file);
if (File == null)
Report.Error ("Cannot load symbol file `{0}'", mdb_file);
else if (ModuleDefinition.Mvid != File.Guid) {
@@ -571,7 +571,7 @@ namespace Mono.Debugger.Backend.Mono
// This must match mono_type_get_desc() in mono/metadata/debug-helpers.c.
protected static string GetTypeSignature (Cecil.TypeReference t)
{
- Cecil.ByReferenceType rtype = t as Cecil.ByReferenceType;
+ Cecil.ReferenceType rtype = t as Cecil.ReferenceType;
if (rtype != null)
return GetTypeSignature (rtype.ElementType) + "&";
@@ -693,7 +693,7 @@ namespace Mono.Debugger.Backend.Mono
signature = null;
}
- var types = Assembly.MainModule.Types;
+ Cecil.TypeDefinitionCollection types = Assembly.MainModule.Types;
// FIXME: Work around an API problem in Cecil.
foreach (Cecil.TypeDefinition type in types) {
if (!method_name.StartsWith (type.FullName))
@@ -773,7 +773,7 @@ namespace Mono.Debugger.Backend.Mono
{
MonoClassType klass = null;
- var types = Assembly.MainModule.Types;
+ Cecil.TypeDefinitionCollection types = Assembly.MainModule.Types;
// FIXME: Work around an API problem in Cecil.
foreach (Cecil.TypeDefinition type in types) {
if (type.FullName != class_name)
@@ -822,23 +822,23 @@ namespace Mono.Debugger.Backend.Mono
if (cname == cgen_attr) {
is_compiler_generated = true;
} else if (cname == debugger_display_attr) {
- string text = (string) cattr.ConstructorArguments [0].Value;
+ string text = (string) cattr.ConstructorParameters [0];
debugger_display = new DebuggerDisplayAttribute (text);
- foreach (var named_arg in cattr.Properties) {
- string key = named_arg.Name;
+ foreach (DictionaryEntry prop in cattr.Properties) {
+ string key = (string) prop.Key;
if (key == "Name")
- debugger_display.Name = (string) named_arg.Argument.Value;
+ debugger_display.Name = (string) prop.Value;
else if (key == "Type")
- debugger_display.Type = (string) named_arg.Argument.Value;
+ debugger_display.Type = (string) prop.Value;
else {
debugger_display = null;
break;
}
}
} else if (cname == browsable_attr) {
- browsable_state = (DebuggerBrowsableState) cattr.GetBlob () [2];
+ browsable_state = (DebuggerBrowsableState) cattr.Blob [2];
} else if (cname == type_proxy_attr) {
- string text = (string) cattr.ConstructorArguments [0].Value;
+ string text = (string) cattr.ConstructorParameters [0];
type_proxy = new DebuggerTypeProxyAttribute (text);
}
}
@@ -1340,7 +1340,7 @@ namespace Mono.Debugger.Backend.Mono
}
}
- var param_info = mdef.Parameters;
+ Cecil.ParameterDefinitionCollection param_info = mdef.Parameters;
for (int i = 0; i < param_info.Count; i++) {
if (captured_vars.ContainsKey (param_info [i].Name))
continue;
diff --git a/backend/mono/MonoThreadManager.cs b/backend/mono/MonoThreadManager.cs
index df0dbab..62f3f12 100644
--- a/backend/mono/MonoThreadManager.cs
+++ b/backend/mono/MonoThreadManager.cs
@@ -64,10 +64,10 @@ namespace Mono.Debugger.Backend.Mono
internal class MonoThreadManager
{
- Process process;
+ ProcessServant process;
MonoDebuggerInfo debugger_info;
- protected MonoThreadManager (Process process, Inferior inferior,
+ protected MonoThreadManager (ProcessServant process, Inferior inferior,
MonoDebuggerInfo debugger_info)
{
this.process = process;
@@ -79,7 +79,7 @@ namespace Mono.Debugger.Backend.Mono
notification_bpt.Insert (inferior);
}
- public static MonoThreadManager Initialize (Process process, Inferior inferior,
+ public static MonoThreadManager Initialize (ProcessServant process, Inferior inferior,
TargetAddress info, bool attach)
{
MonoDebuggerInfo debugger_info = MonoDebuggerInfo.Create (inferior, info);
@@ -106,7 +106,6 @@ namespace Mono.Debugger.Backend.Mono
AddressBreakpoint notification_bpt;
IntPtr mono_runtime_info;
int debugger_version;
- int thread_abort_signal;
internal bool HasCodeBuffer {
get;
@@ -150,11 +149,6 @@ namespace Mono.Debugger.Backend.Mono
notification_bpt.Remove (inferior);
notification_bpt = null;
}
-
- if (debugger_info.HasThreadAbortSignal)
- thread_abort_signal = inferior.ReadInteger (debugger_info.ThreadAbortSignal);
- else
- thread_abort_signal = inferior.MonoThreadAbortSignal;
}
internal void InitCodeBuffer (Inferior inferior, TargetAddress code_buffer)
@@ -255,8 +249,8 @@ namespace Mono.Debugger.Backend.Mono
{
if ((flags & (ThreadFlags.Internal | ThreadFlags.ThreadPool)) != ThreadFlags.Internal) {
engine.Thread.ThreadFlags &= ~(Thread.Flags.Daemon | Thread.Flags.Immutable);
- if (engine != process.MainThreadServant)
- process.Debugger.OnManagedThreadCreatedEvent (engine.Thread);
+ if (engine != process.MainThread)
+ process.Debugger.Client.OnManagedThreadCreatedEvent (engine.Thread);
} else if ((flags & ThreadFlags.ThreadPool) != 0) {
engine.Thread.ThreadFlags &= ~Thread.Flags.Immutable;
}
@@ -323,13 +317,13 @@ namespace Mono.Debugger.Backend.Mono
case NotificationType.AcquireGlobalThreadLock:
Report.Debug (DebugFlags.Threads,
"{0} received notification {1}", engine, type);
- engine.Process.AcquireGlobalThreadLock (engine);
+ engine.ProcessServant.AcquireGlobalThreadLock (engine);
break;
case NotificationType.ReleaseGlobalThreadLock:
Report.Debug (DebugFlags.Threads,
"{0} received notification {1}", engine, type);
- engine.Process.ReleaseGlobalThreadLock (engine);
+ engine.ProcessServant.ReleaseGlobalThreadLock (engine);
break;
case NotificationType.ThreadCreated: {
@@ -370,7 +364,7 @@ namespace Mono.Debugger.Backend.Mono
"{0} created gc thread: {1:x} {2}",
engine, tid, data);
- engine = engine.Process.GetEngineByTID (inferior, tid);
+ engine = engine.ProcessServant.GetEngineByTID (inferior, tid);
if (engine == null)
throw new InternalError ();
@@ -393,7 +387,7 @@ namespace Mono.Debugger.Backend.Mono
case NotificationType.InitializeThreadManager:
csharp_language = inferior.Process.CreateMonoLanguage (
debugger_info);
- if (engine.Process.IsAttached)
+ if (engine.ProcessServant.IsAttached)
csharp_language.InitializeAttach (inferior);
else
csharp_language.Initialize (inferior);
@@ -403,7 +397,7 @@ namespace Mono.Debugger.Backend.Mono
case NotificationType.ReachedMain: {
Inferior.StackFrame iframe = inferior.GetCurrentFrame (false);
engine.SetMainReturnAddress (iframe.StackPointer);
- engine.Process.OnProcessReachedMainEvent ();
+ engine.ProcessServant.OnProcessReachedMainEvent ();
resume_target = !engine.InitializeBreakpoints ();
return true;
}
@@ -471,7 +465,7 @@ namespace Mono.Debugger.Backend.Mono
}
if ((cevent.Type == Inferior.ChildEventType.CHILD_STOPPED) &&
- (cevent.Argument == thread_abort_signal)) {
+ (cevent.Argument == inferior.MonoThreadAbortSignal)) {
resume_target = true;
return true;
}
@@ -545,8 +539,6 @@ namespace Mono.Debugger.Backend.Mono
public readonly TargetAddress AbortRuntimeInvoke = TargetAddress.Null;
- public readonly TargetAddress ThreadAbortSignal = TargetAddress.Null;
-
public static MonoDebuggerInfo Create (TargetMemoryAccess memory, TargetAddress info)
{
TargetBinaryReader header = memory.ReadMemory (info, 24).GetReader ();
@@ -596,10 +588,6 @@ namespace Mono.Debugger.Backend.Mono
get { return CheckRuntimeVersion (81, 5); }
}
- public bool HasThreadAbortSignal {
- get { return CheckRuntimeVersion (81, 6); }
- }
-
protected MonoDebuggerInfo (TargetMemoryAccess memory, TargetReader reader)
{
reader.Offset = 8;
@@ -659,9 +647,6 @@ namespace Mono.Debugger.Backend.Mono
if (HasAbortRuntimeInvoke)
AbortRuntimeInvoke = reader.ReadAddress ();
- if (HasThreadAbortSignal)
- ThreadAbortSignal = reader.ReadAddress ();
-
Report.Debug (DebugFlags.JitSymtab, this);
}
}
diff --git a/backend/os/Bfd.cs b/backend/os/Bfd.cs
index 178e3da..ff6a8ca 100644
--- a/backend/os/Bfd.cs
+++ b/backend/os/Bfd.cs
@@ -463,12 +463,12 @@ namespace Mono.Debugger.Backend
}
}
- public Process Process {
+ public ProcessServant Process {
get { return os.Process; }
}
public NativeLanguage NativeLanguage {
- get { return (NativeLanguage) os.Process.NativeLanguage; }
+ get { return os.Process.NativeLanguage; }
}
internal DwarfReader DwarfReader {
diff --git a/backend/os/BfdDisassembler.cs b/backend/os/BfdDisassembler.cs
index 0ba006a..b43a3c8 100644
--- a/backend/os/BfdDisassembler.cs
+++ b/backend/os/BfdDisassembler.cs
@@ -13,7 +13,7 @@ namespace Mono.Debugger.Backend
internal class BfdDisassembler : Disassembler, IDisposable
{
IntPtr handle;
- Process process;
+ ProcessServant process;
[DllImport("monodebuggerserver")]
extern static int bfd_glue_disassemble_insn (IntPtr handle, long address);
@@ -28,7 +28,7 @@ namespace Mono.Debugger.Backend
OutputHandler output_handler;
PrintAddressHandler print_handler;
- internal BfdDisassembler (Process process, bool is_x86_64)
+ internal BfdDisassembler (ProcessServant process, bool is_x86_64)
{
this.process = process;
diff --git a/backend/os/DarwinOperatingSystem.cs b/backend/os/DarwinOperatingSystem.cs
index 045b732..1fccc2f 100644
--- a/backend/os/DarwinOperatingSystem.cs
+++ b/backend/os/DarwinOperatingSystem.cs
@@ -12,7 +12,7 @@ namespace Mono.Debugger.Backend
Hashtable bfd_hash;
Bfd main_bfd;
- public DarwinOperatingSystem (Process process)
+ public DarwinOperatingSystem (ProcessServant process)
: base (process)
{
this.bfd_hash = Hashtable.Synchronized (new Hashtable ());
diff --git a/backend/os/DwarfReader.cs b/backend/os/DwarfReader.cs
index 055e154..6a7ed80 100644
--- a/backend/os/DwarfReader.cs
+++ b/backend/os/DwarfReader.cs
@@ -108,7 +108,6 @@ namespace Mono.Debugger.Backend
ObjectCache debug_pubnames_reader;
ObjectCache debug_pubtypes_reader;
ObjectCache debug_str_reader;
- ObjectCache debug_ranges_reader;
Hashtable source_file_hash;
Hashtable method_source_hash;
@@ -151,7 +150,6 @@ namespace Mono.Debugger.Backend
debug_pubtypes_reader = create_reader (".debug_pubtypes", true);
debug_str_reader = create_reader (".debug_str", true);
debug_loc_reader = create_reader (".debug_loc", false);
- debug_ranges_reader = create_reader (".debug_ranges", true);
compile_unit_hash = Hashtable.Synchronized (new Hashtable ());
method_source_hash = Hashtable.Synchronized (new Hashtable ());
@@ -789,13 +787,6 @@ namespace Mono.Debugger.Backend
}
}
- public DwarfBinaryReader DebugRangesReader {
- get {
- return new DwarfBinaryReader (
- bfd, (TargetBlob) debug_ranges_reader.Data, Is64Bit);
- }
- }
-
public string FileName {
get {
return filename;
@@ -881,8 +872,7 @@ namespace Mono.Debugger.Backend
try_block = 0x32,
variant_block = 0x33,
variable = 0x34,
- volatile_type = 0x35,
- dwarf3_namespace = 0x39
+ volatile_type = 0x35
}
protected enum DwarfAttribute {
@@ -944,10 +934,7 @@ namespace Mono.Debugger.Backend
use_location = 0x4a,
variable_parameter = 0x4b,
virtuality = 0x4c,
- vtable_elem_location = 0x4d,
- entry_pc = 0x52,
- extension = 0x54,
- ranges = 0x55
+ vtable_elem_location = 0x4d
}
protected enum DwarfBaseTypeEncoding {
@@ -1781,11 +1768,8 @@ namespace Mono.Debugger.Backend
children = new ArrayList ();
- while (reader.PeekByte () != 0) {
- Die child = CreateDie (reader, comp_unit);
- child.ReadChildren (reader);
- children.Add (child);
- }
+ while (reader.PeekByte () != 0)
+ children.Add (CreateDie (reader, comp_unit));
reader.Position++;
return children;
@@ -1822,6 +1806,11 @@ namespace Mono.Debugger.Backend
debug ("NEW DIE: {0} {1} {2} {3}", GetType (),
abbrev, Offset, ChildrenOffset);
+
+ if (this is DieCompileUnit)
+ return;
+
+ ReadChildren (reader);
}
public Die CreateDie (DwarfBinaryReader reader, CompilationUnit comp_unit)
@@ -1893,9 +1882,6 @@ namespace Mono.Debugger.Backend
debug ("INLINED SUBROUTINE!");
return new DieSubprogram (reader, comp_unit, offset, abbrev);
- case DwarfTag.dwarf3_namespace:
- return new DieNamespace (reader, comp_unit, offset, abbrev);
-
default:
return new Die (reader, comp_unit, abbrev);
}
@@ -1922,7 +1908,7 @@ namespace Mono.Debugger.Backend
AbbrevEntry abbrev)
: base (reader, comp_unit, abbrev)
{
- if ((start_pc != null) && (end_pc != null))
+ if ((start_pc != 0) && (end_pc != 0))
is_continuous = true;
string file_name;
@@ -1934,7 +1920,7 @@ namespace Mono.Debugger.Backend
file = dwarf.GetSourceFile (file_name);
}
- long? start_pc, end_pc, entry_pc;
+ long start_pc, end_pc;
string name;
string comp_dir;
bool is_continuous;
@@ -2035,10 +2021,6 @@ namespace Mono.Debugger.Backend
end_pc = (long) attribute.Data;
break;
- case DwarfAttribute.entry_pc:
- entry_pc = (long) attribute.Data;
- break;
-
case DwarfAttribute.stmt_list:
line_offset = (long) attribute.Data;
has_lines = true;
@@ -2100,7 +2082,7 @@ namespace Mono.Debugger.Backend
if (!is_continuous)
throw new InvalidOperationException ();
- return dwarf.GetAddress ((long) start_pc);
+ return dwarf.GetAddress (start_pc);
}
}
@@ -2109,18 +2091,7 @@ namespace Mono.Debugger.Backend
if (!is_continuous)
throw new InvalidOperationException ();
- return dwarf.GetAddress ((long) end_pc);
- }
- }
-
- public TargetAddress BaseAddress {
- get {
- if (entry_pc != null)
- return dwarf.GetAddress ((long) entry_pc);
- else if (start_pc != null)
- return dwarf.GetAddress ((long) start_pc);
- else
- return TargetAddress.Null;
+ return dwarf.GetAddress (end_pc);
}
}
@@ -2182,11 +2153,10 @@ namespace Mono.Debugger.Backend
long abstract_origin, specification;
long real_offset, start_pc, end_pc;
bool is_continuous, resolved;
- string full_name, name;
+ string name;
DwarfTargetMethod method;
LineNumberEngine engine;
ArrayList param_dies, local_dies;
- TargetVariable this_var;
TargetVariable[] parameters, locals;
DwarfLocation frame_base;
@@ -2197,17 +2167,17 @@ namespace Mono.Debugger.Backend
switch (attribute.DwarfAttribute) {
case DwarfAttribute.low_pc:
start_pc = (long) attribute.Data;
- debug ("{0}: start_pc = {1:x}", Offset, start_pc);
+ // Console.WriteLine ("{0}: start_pc = {1:x}", Offset, start_pc);
break;
case DwarfAttribute.high_pc:
end_pc = (long) attribute.Data;
- debug ("{0}: end_pc = {1:x}", Offset, end_pc);
+ // Console.WriteLine ("{0}: end_pc = {1:x}", Offset, end_pc);
break;
case DwarfAttribute.name:
name = (string) attribute.Data;
- debug ("{0}: name = {1}", Offset, name);
+ // Console.WriteLine ("{0}: name = {1}", Offset, name);
break;
case DwarfAttribute.frame_base:
@@ -2231,7 +2201,7 @@ namespace Mono.Debugger.Backend
case DwarfAttribute.abstract_origin:
abstract_origin = (long) attribute.Data;
- debug ("{0} ABSTRACT ORIGIN: {1}", Offset, abstract_origin);
+ // debug ("{0} ABSTRACT ORIGIN: {1}", Offset, abstract_origin);
break;
case DwarfAttribute.specification:
@@ -2251,9 +2221,6 @@ namespace Mono.Debugger.Backend
case DwarfTag.variable:
return new DieVariable (this, reader, comp_unit, abbrev);
- case DwarfTag.lexical_block:
- return new DieLexicalBlock (this, reader, comp_unit, abbrev);
-
default:
return base.CreateDie (reader, comp_unit, offset, abbrev);
}
@@ -2299,7 +2266,7 @@ namespace Mono.Debugger.Backend
public string Name {
get {
- return full_name ?? name ?? "<unknown>";
+ return name != null ? name : "<unknown>";
}
}
@@ -2412,121 +2379,57 @@ namespace Mono.Debugger.Backend
return retval;
}
- public bool HasThis {
- get {
- return this_var != null;
- }
- }
-
- public TargetVariable This {
- get {
- if (this_var == null)
- throw new InvalidOperationException ();
-
- return this_var;
- }
- }
-
public TargetVariable[] Parameters {
get {
+ if (parameters == null)
+ parameters = resolve_variables (param_dies);
+
return parameters;
}
}
public TargetVariable[] Locals {
get {
+ if (locals == null)
+ locals = resolve_variables (local_dies);
+
return locals;
}
}
- public void Resolve ()
+ public void ReadLineNumbers ()
{
if (resolved)
return;
- try {
- DoResolve ();
- resolved = true;
- } catch (Exception ex) {
- debug ("{0} FUCK: {1}", Offset, ex);
- return;
- }
- }
-
- void DoResolveSpecification (DieSubprogram specification)
- {
- specification.Resolve ();
-
- if ((name == null) && (specification.name != null))
- name = specification.name;
- if ((local_dies == null) && (specification.local_dies != null))
- local_dies = specification.local_dies;
- if ((param_dies == null) && (specification.param_dies != null))
- param_dies = specification.param_dies;
- }
+ resolved = true;
- void DoResolve ()
- {
if (abstract_origin != 0) {
+ debug ("READ LINE NUMBERS: {0} {1}", this,
+ abstract_origin);
DieSubprogram aorigin = comp_unit.GetSubprogram (abstract_origin);
+ debug ("READ LINE NUMBERS #1: {0}", aorigin);
if (aorigin == null)
throw new InternalError ();
- DoResolveSpecification (aorigin);
+ aorigin.ReadLineNumbers ();
}
if (specification != 0) {
+ debug ("READ LINE NUMBERS #2: {0} {1}", this, specification);
DieSubprogram ssubprog = comp_unit.GetSubprogram (specification);
+ debug ("READ LINE NUMBERS #1: {0}", ssubprog);
if (ssubprog == null)
throw new InternalError ();
- DoResolveSpecification (ssubprog);
- }
-
- locals = resolve_variables (local_dies);
- parameters = resolve_variables (param_dies);
-
- if (param_dies != null) {
- DieMethodVariable first_var = (DieMethodVariable) param_dies [0];
- if ((first_var.IsArtificial != null) && (first_var.Name == "this"))
- this_var = first_var.Variable;
- }
-
- debug ("{0} resolve: {1} {2} {3} {4}", Offset, param_dies != null, local_dies != null,
- name != null, this_var != null);
-
- if ((param_dies != null) && (name != null)) {
- StringBuilder sb = new StringBuilder ();
- if (this_var != null) {
- sb.Append (this_var.Type.Name);
- sb.Append ("::");
- }
- sb.Append (name);
- sb.Append ("(");
- bool first = true;
- for (int i = 0; i < param_dies.Count; i++) {
- DieMethodVariable the_param = (DieMethodVariable) param_dies [i];
- if (!first)
- sb.Append (", ");
- if (the_param.Type == null)
- continue;
- sb.Append (the_param.Type.Name);
- if (the_param.Name != null) {
- sb.Append (" ");
- sb.Append (the_param.Name);
- }
- first = false;
- }
- sb.Append (")");
- full_name = sb.ToString ();
+ ssubprog.ReadLineNumbers ();
}
}
public override string ToString ()
{
return String.Format ("{0} ({1}:{2}:{3}:{4:x}:{5:x})", GetType (),
- name ?? "<unknown>", Offset, RealOffset,
- start_pc, end_pc);
+ Name, Offset, RealOffset, start_pc, end_pc);
}
}
@@ -2619,7 +2522,6 @@ namespace Mono.Debugger.Backend
this.engine = engine;
CheckLoaded ();
- Name = subprog.Name;
}
public DwarfReader DwarfReader {
@@ -2636,25 +2538,16 @@ namespace Mono.Debugger.Backend
public override TargetClassType GetDeclaringType (Thread target)
{
- if (!subprog.HasThis)
- return null;
-
- var type = subprog.This.Type;
-
- var ptype = type as TargetPointerType;
- if (ptype != null)
- type = ptype.StaticType;
-
- return (TargetClassType) type;
+ return null;
}
public override bool HasThis {
- get { return subprog.HasThis; }
+ get { return false; }
}
public override TargetVariable GetThis (Thread target)
{
- return subprog.This;
+ throw new InvalidOperationException ();
}
public override TargetVariable[] GetParameters (Thread target)
@@ -2707,17 +2600,23 @@ namespace Mono.Debugger.Backend
if (source != null)
return;
- subprog.Resolve ();
+ subprog.ReadLineNumbers ();
SourceAddress start = engine.Lookup (StartAddress);
SourceAddress end = engine.Lookup (EndAddress);
+ debug ("DTM - READ LNT #0: {0} {1} - {2} {3}",
+ this, subprog, start, end);
+
if ((start == null) || (end == null))
return;
start_row = start.Row;
end_row = end.Row;
+ debug ("DTM - READ LNT: {0} {1} - {2} {3}", start.LineOffset,
+ start.LineRange, end.LineOffset, end.LineRange);
+
SetMethodBounds (StartAddress + start.LineRange,
EndAddress - end.LineOffset);
@@ -2758,7 +2657,6 @@ namespace Mono.Debugger.Backend
Hashtable abbrevs;
Hashtable types;
Hashtable subprogs;
- Dictionary<long,DieNamespace> namespaces;
public CompilationUnit (DwarfReader dwarf, DwarfBinaryReader reader)
{
@@ -2779,7 +2677,6 @@ namespace Mono.Debugger.Backend
abbrevs = new Hashtable ();
types = new Hashtable ();
subprogs = new Hashtable ();
- namespaces = new Dictionary<long,DieNamespace> ();
DwarfBinaryReader abbrev_reader = dwarf.DebugAbbrevReader;
@@ -2824,10 +2721,6 @@ namespace Mono.Debugger.Backend
}
}
- internal string CurrentNamespace {
- get; set;
- }
-
public AbbrevEntry this [int abbrev_id] {
get {
if (abbrevs.Contains (abbrev_id))
@@ -2849,11 +2742,6 @@ namespace Mono.Debugger.Backend
subprogs.Add (offset, subprog);
}
- public void AddNamespace (long offset, DieNamespace ns)
- {
- namespaces.Add (offset, ns);
- }
-
public DieType GetType (long offset)
{
return (DieType) types [real_start_offset + offset];
@@ -2864,11 +2752,6 @@ namespace Mono.Debugger.Backend
return (DieSubprogram) subprogs [real_start_offset + offset];
}
- public DieNamespace GetNamespace (long offset)
- {
- return namespaces [real_start_offset + offset];
- }
-
public override string ToString ()
{
return String.Format ("CompilationUnit ({0},{1},{2} - {3},{4},{5})",
@@ -2880,24 +2763,17 @@ namespace Mono.Debugger.Backend
protected class DwarfLocation
{
- CompilationUnit comp_unit;
- DwarfLocation frame_base;
+ DieSubprogram subprog;
byte[] location_block;
long loclist_offset;
bool is_byref;
public DwarfLocation (DieSubprogram subprog, Attribute attribute, bool is_byref)
- : this (subprog.comp_unit, subprog.FrameBase, attribute, is_byref)
- { }
-
- public DwarfLocation (CompilationUnit comp_unit, DwarfLocation frame_base,
- Attribute attribute, bool is_byref)
{
- this.comp_unit = comp_unit;
- this.frame_base = frame_base;
+ this.subprog = subprog;
this.is_byref = is_byref;
- if (comp_unit == null)
+ if (subprog == null)
throw new InternalError ();
switch (attribute.DwarfForm) {
@@ -2919,7 +2795,7 @@ namespace Mono.Debugger.Backend
byte[] data)
{
TargetBinaryReader locreader = new TargetBinaryReader (
- data, comp_unit.DwarfReader.TargetMemoryInfo);
+ data, subprog.dwarf.TargetMemoryInfo);
byte opcode = locreader.ReadByte ();
bool is_regoffset;
@@ -2940,9 +2816,10 @@ namespace Mono.Debugger.Backend
} else if (opcode == 0x91) { // DW_OP_fbreg
off = locreader.ReadSLeb128 ();
- if (frame_base != null) {
+ if (subprog.FrameBase != null) {
TargetLocation rloc = new RelativeTargetLocation (
- frame_base.GetLocation (frame, memory), off);
+ subprog.FrameBase.GetLocation (frame, memory),
+ off);
if (is_byref)
return new DereferencedTargetLocation (rloc);
else
@@ -2968,16 +2845,14 @@ namespace Mono.Debugger.Backend
return null;
}
- reg = comp_unit.DwarfReader.bfd.Architecture.DwarfFrameRegisterMap [reg];
+ reg = subprog.dwarf.bfd.Architecture.DwarfFrameRegisterMap [reg];
MonoVariableLocation loc = MonoVariableLocation.Create (
memory, is_regoffset, frame.Registers [reg],
off, is_byref);
- if (!locreader.IsEof) {
- Console.WriteLine ("LOCREADER NOT AT EOF!");
+ if (!locreader.IsEof)
return null;
- }
return loc;
}
@@ -2987,12 +2862,11 @@ namespace Mono.Debugger.Backend
if (location_block != null)
return GetLocation (frame, memory, location_block);
- DwarfBinaryReader reader = comp_unit.DwarfReader.DebugLocationReader;
+ DwarfBinaryReader reader = subprog.dwarf.DebugLocationReader;
reader.Position = loclist_offset;
TargetAddress address = frame.TargetAddress;
- TargetAddress base_address = comp_unit.DieCompileUnit.BaseAddress;
-
+ TargetAddress base_address = subprog.DieCompileUnit.StartAddress;
while (true) {
long start = reader.ReadAddress ();
@@ -3000,7 +2874,7 @@ namespace Mono.Debugger.Backend
if (start == -1) {
Console.WriteLine ("BASE SELECTION: {0:x}", end);
- base_address = comp_unit.DwarfReader.GetAddress (end);
+ base_address = subprog.dwarf.GetAddress (end);
continue;
}
@@ -3019,30 +2893,7 @@ namespace Mono.Debugger.Backend
return null;
}
- public TargetLocation GetLocation (TargetLocation location)
- {
- if (location_block == null)
- throw new NotImplementedException ();
-
- TargetBinaryReader locreader = new TargetBinaryReader (
- location_block, comp_unit.DwarfReader.TargetMemoryInfo);
- byte opcode = locreader.ReadByte ();
-
- if (opcode == 0x23) // DW_OP_plus_uconst
- location = new RelativeTargetLocation (location, locreader.ReadLeb128 ());
- else {
- Console.WriteLine ("UNKNOWN OPCODE: {0:x}", opcode);
- return null;
- }
-
- if (!locreader.IsEof) {
- Console.WriteLine ("LOCREADER NOT AT EOF!");
- return null;
- }
-
- return location;
- }
}
protected class DwarfTargetVariable : TargetVariable
@@ -3050,15 +2901,18 @@ namespace Mono.Debugger.Backend
readonly string name;
readonly TargetType type;
readonly DwarfLocation location;
- readonly DieLexicalBlock lexical_block;
- public DwarfTargetVariable (DieSubprogram subprog, string name, TargetType type,
- DwarfLocation location, DieLexicalBlock lexical_block)
+ protected DwarfTargetVariable (DieSubprogram subprog, string name, TargetType type)
{
this.name = name;
this.type = type;
+ }
+
+ public DwarfTargetVariable (DieSubprogram subprog, string name, TargetType type,
+ DwarfLocation location)
+ : this (subprog, name, type)
+ {
this.location = location;
- this.lexical_block = lexical_block;
}
public override string Name {
@@ -3071,9 +2925,6 @@ namespace Mono.Debugger.Backend
public override bool IsInScope (TargetAddress address)
{
- if (lexical_block != null)
- return lexical_block.IsInRange (address);
-
return true;
}
@@ -3131,68 +2982,10 @@ namespace Mono.Debugger.Backend
}
}
- protected class DieNamespace : Die
- {
- long offset;
- string name;
- DieNamespace extension;
-
- public DieNamespace (DwarfBinaryReader reader, CompilationUnit comp_unit,
- long offset, AbbrevEntry abbrev)
- : base (reader, comp_unit, abbrev)
- {
- this.offset = offset;
- comp_unit.AddNamespace (offset, this);
-
- if (extension != null) {
- if (extension.name != null) {
- if (name != null)
- name = extension.name + "::" + name;
- else
- name = extension.name;
- }
- }
- }
-
- protected override void ProcessAttribute (Attribute attribute)
- {
- debug ("NAMESPACE ATTRIBUTE: {0}", attribute);
- switch (attribute.DwarfAttribute) {
- case DwarfAttribute.name:
- name = (string) attribute.Data;
- break;
- case DwarfAttribute.extension:
- debug ("NAMESPACE EXTENSION: {0}", attribute);
- extension = comp_unit.GetNamespace ((long) attribute.Data);
- break;
- }
- }
-
- protected override ArrayList ReadChildren (DwarfBinaryReader reader)
- {
- string old_ns = comp_unit.CurrentNamespace;
- if (name == null)
- comp_unit.CurrentNamespace = null;
- else if (comp_unit.CurrentNamespace != null)
- comp_unit.CurrentNamespace = comp_unit.CurrentNamespace + "::" + name;
- else
- comp_unit.CurrentNamespace = name;
-
- try {
- debug ("NS CHILDREN: {0} -> {1}", name, comp_unit.CurrentNamespace);
- return base.ReadChildren (reader);
- debug ("NS CHILDREN DONE: {0}", name);
- } finally {
- comp_unit.CurrentNamespace = old_ns;
- }
- }
- }
-
protected abstract class DieType : Die, ITypeEntry
{
string name;
protected long offset;
- DieType specification;
bool resolved, type_created;
protected readonly Language language;
TargetType type;
@@ -3205,16 +2998,8 @@ namespace Mono.Debugger.Backend
this.language = reader.Bfd.NativeLanguage;
comp_unit.AddType (offset, this);
- if (specification != null) {
- if ((name == null) && (specification.name != null))
- name = specification.Name;
- }
-
- if (name != null) {
- if (comp_unit.CurrentNamespace != null)
- name = comp_unit.CurrentNamespace + "::" + name;
+ if (name != null)
comp_unit.DwarfReader.AddType (this);
- }
}
protected override void ProcessAttribute (Attribute attribute)
@@ -3223,9 +3008,6 @@ namespace Mono.Debugger.Backend
case DwarfAttribute.name:
name = (string) attribute.Data;
break;
- case DwarfAttribute.specification:
- specification = comp_unit.GetType ((long) attribute.Data);
- break;
}
}
@@ -3247,7 +3029,6 @@ namespace Mono.Debugger.Backend
resolved = true;
if (type == null) {
- debug ("RESOLVE TYPE FAILED: {0}", this);
type_created = true;
return null;
}
@@ -3288,6 +3069,14 @@ namespace Mono.Debugger.Backend
}
}
+ protected void SetName (string name)
+ {
+ if (resolved)
+ throw new InvalidOperationException ();
+
+ this.name = name;
+ }
+
internal TargetType GetAlias (string name)
{
if (this.name == null) {
@@ -3396,11 +3185,6 @@ namespace Mono.Debugger.Backend
else if (byte_size <= 8)
return FundamentalKind.Double;
break;
-
- case DwarfBaseTypeEncoding.boolean:
- if (byte_size == 1)
- return FundamentalKind.Boolean;
- break;
}
return FundamentalKind.Unknown;
@@ -3803,13 +3587,9 @@ namespace Mono.Debugger.Backend
protected class DieInheritance : Die
{
long type_offset;
- DwarfLocation data_member_location;
+ long data_member_location;
DieType reference;
- DwarfBaseInfo base_info;
- NativeStructType base_type;
- bool resolved;
-
public DieInheritance (DwarfBinaryReader reader,
CompilationUnit comp_unit,
AbbrevEntry abbrev)
@@ -3824,7 +3604,11 @@ namespace Mono.Debugger.Backend
break;
case DwarfAttribute.data_member_location:
- data_member_location = new DwarfLocation (comp_unit, null, attribute, false);
+ // the location is specified as a
+ // block, it appears.. not sure the
+ // format, but it definitely isn't a (long).
+ //
+ // data_member_location = (long)attribute.Data;
break;
default:
@@ -3836,64 +3620,6 @@ namespace Mono.Debugger.Backend
public long TypeOffset {
get { return type_offset; }
}
-
- public bool HasDataMember {
- get { return data_member_location != null; }
- }
-
- public DwarfLocation DataMember {
- get { return data_member_location; }
- }
-
- public DwarfBaseInfo BaseInfo {
- get {
- Resolve ();
- return base_info;
- }
- }
-
- public bool Resolve ()
- {
- if (resolved)
- return base_info != null;
-
- try {
- DoResolve ();
- return base_info != null;
- } finally {
- resolved = true;
- }
- }
-
- void DoResolve ()
- {
- DieType type = comp_unit.GetType (type_offset);
- if (type == null)
- return;
-
- base_type = type.ResolveType () as NativeStructType;
- if (base_type == null)
- return;
-
- base_info = new DwarfBaseInfo (this, base_type);
- }
- }
-
- protected class DwarfBaseInfo : NativeBaseInfo
- {
- public readonly DieInheritance Inheritance;
-
- public DwarfBaseInfo (DieInheritance inheritance, NativeStructType base_type)
- : base (base_type)
- {
- this.Inheritance = inheritance;
- }
-
- public override TargetLocation GetBaseLocation (TargetMemoryAccess memory,
- TargetLocation location)
- {
- return Inheritance.DataMember.GetLocation (location);
- }
}
protected class DieStructureType : DieType
@@ -3937,7 +3663,6 @@ namespace Mono.Debugger.Backend
ArrayList members;
NativeFieldInfo[] fields;
NativeStructType type;
- DwarfBaseInfo base_info;
public override bool IsComplete {
get { return abbrev.HasChildren; }
@@ -3945,21 +3670,10 @@ namespace Mono.Debugger.Backend
protected override TargetType CreateType ()
{
- if (!abbrev.HasChildren)
+ if (abbrev.HasChildren)
+ type = new NativeStructType (language, Name, fields, byte_size);
+ else
return new NativeTypeAlias (language, Name, Name);
-
- foreach (Die child in Children) {
- DieInheritance inheritance = child as DieInheritance;
- if ((inheritance == null) || !inheritance.HasDataMember)
- continue;
- if (!inheritance.Resolve ())
- continue;
- debug ("INHERITANCE: {0} {1}", inheritance, inheritance.BaseInfo);
- base_info = inheritance.BaseInfo;
- break;
- }
-
- type = new NativeStructType (language, Name, byte_size, base_info);
return type;
}
@@ -4042,6 +3756,9 @@ namespace Mono.Debugger.Backend
protected override TargetType CreateType ()
{
+ if (!prototyped)
+ return null;
+
if (type_offset != 0) {
return_type = GetReference (type_offset);
if (return_type == null)
@@ -4079,84 +3796,6 @@ namespace Mono.Debugger.Backend
}
}
- protected class DieLexicalBlock : Die
- {
- DieSubprogram subprog;
- long? ranges_offset;
-
- public DieLexicalBlock (DieSubprogram subprog, DwarfBinaryReader reader,
- CompilationUnit comp_unit, AbbrevEntry abbrev)
- : base (reader, comp_unit, abbrev)
- {
- this.subprog = subprog;
- }
-
- protected override Die CreateDie (DwarfBinaryReader reader, CompilationUnit comp_unit,
- long offset, AbbrevEntry abbrev)
- {
- switch (abbrev.Tag) {
- case DwarfTag.formal_parameter:
- return new DieFormalParameter (subprog, reader, comp_unit, abbrev);
-
- case DwarfTag.variable:
- return new DieVariable (subprog, reader, comp_unit, abbrev, this);
-
- case DwarfTag.lexical_block:
- return new DieLexicalBlock (subprog, reader, comp_unit, abbrev);
-
- default:
- debug ("LEXICAL BLOCK ({0}): unknown die: {1}", Offset, abbrev.Tag);
- return base.CreateDie (reader, comp_unit, offset, abbrev);
- }
- }
-
- protected override void ProcessAttribute (Attribute attribute)
- {
- switch (attribute.DwarfAttribute) {
- case DwarfAttribute.ranges:
- ranges_offset = (long) attribute.Data;
- break;
-
- default:
- debug ("UNKNOWN ATTRIBUTE: {0} {1}", this, attribute);
- base.ProcessAttribute (attribute);
- break;
- }
- }
-
- public bool IsInRange (TargetAddress address)
- {
- if (ranges_offset == null)
- return true;
-
- DwarfBinaryReader reader = comp_unit.DwarfReader.DebugRangesReader;
- reader.Position = (long) ranges_offset;
-
- TargetAddress base_address = comp_unit.DieCompileUnit.BaseAddress;
-
- while (true) {
- long start = reader.ReadAddress ();
- long end = reader.ReadAddress ();
-
- if (start == -1) {
- Console.WriteLine ("BASE SELECTION: {0:x}", end);
- base_address = comp_unit.DwarfReader.GetAddress (end);
- continue;
- }
-
- if ((start == 0) && (end == 0))
- break;
-
- if ((address < base_address+start) || (address >= base_address+end))
- continue;
-
- return true;
- }
-
- return false;
- }
- }
-
protected abstract class DieVariableBase : Die
{
string name;
@@ -4195,22 +3834,16 @@ namespace Mono.Debugger.Backend
return type_offset;
}
}
-
- public override string ToString ()
- {
- return String.Format ("{0} ({1}:{2})", GetType ().Name, type_offset, name);
- }
}
protected abstract class DieMethodVariable : DieVariableBase
{
public DieMethodVariable (DieSubprogram subprog, DwarfBinaryReader reader,
CompilationUnit comp_unit, AbbrevEntry abbrev,
- DieLexicalBlock lexical_block, bool is_local)
+ bool is_local)
: base (reader, comp_unit, abbrev)
{
this.subprog = subprog;
- this.lexical_block = lexical_block;
if (subprog != null) {
if (is_local)
@@ -4227,10 +3860,6 @@ namespace Mono.Debugger.Backend
location_attr = attribute;
break;
- case DwarfAttribute.artificial:
- artificial = (bool) attribute.Data;
- break;
-
default:
base.ProcessAttribute (attribute);
break;
@@ -4238,11 +3867,9 @@ namespace Mono.Debugger.Backend
}
Attribute location_attr;
- DwarfTargetVariable variable;
+ TargetVariable variable;
DieSubprogram subprog;
TargetType type;
- DieLexicalBlock lexical_block;
- bool artificial;
bool resolved;
protected bool DoResolveType ()
@@ -4270,8 +3897,7 @@ namespace Mono.Debugger.Backend
DwarfLocation location = new DwarfLocation (
subprog, location_attr, type.IsByRef);
- variable = new DwarfTargetVariable (
- subprog, Name, type, location, lexical_block);
+ variable = new DwarfTargetVariable (subprog, Name, type, location);
return true;
}
@@ -4282,7 +3908,7 @@ namespace Mono.Debugger.Backend
}
}
- public DwarfTargetVariable Variable {
+ public TargetVariable Variable {
get {
if (!resolved) {
DoResolve ();
@@ -4292,19 +3918,13 @@ namespace Mono.Debugger.Backend
return variable;
}
}
-
- public bool IsArtificial {
- get {
- return artificial;
- }
- }
}
protected class DieFormalParameter : DieMethodVariable
{
public DieFormalParameter (DieSubprogram parent, DwarfBinaryReader reader,
CompilationUnit comp_unit, AbbrevEntry abbrev)
- : base (parent, reader, comp_unit, abbrev, null, false)
+ : base (parent, reader, comp_unit, abbrev, false)
{ }
}
@@ -4312,13 +3932,7 @@ namespace Mono.Debugger.Backend
{
public DieVariable (DieSubprogram parent, DwarfBinaryReader reader,
CompilationUnit comp_unit, AbbrevEntry abbrev)
- : base (parent, reader, comp_unit, abbrev, null, true)
- { }
-
- public DieVariable (DieSubprogram parent, DwarfBinaryReader reader,
- CompilationUnit comp_unit, AbbrevEntry abbrev,
- DieLexicalBlock lexical)
- : base (parent, reader, comp_unit, abbrev, lexical, true)
+ : base (parent, reader, comp_unit, abbrev, true)
{ }
}
diff --git a/backend/os/LinuxOperatingSystem.cs b/backend/os/LinuxOperatingSystem.cs
index b6437eb..b9cd6fa 100644
--- a/backend/os/LinuxOperatingSystem.cs
+++ b/backend/os/LinuxOperatingSystem.cs
@@ -12,7 +12,7 @@ namespace Mono.Debugger.Backend
Hashtable bfd_hash;
Bfd main_bfd;
- public LinuxOperatingSystem (Process process)
+ public LinuxOperatingSystem (ProcessServant process)
: base (process)
{
this.bfd_hash = Hashtable.Synchronized (new Hashtable ());
diff --git a/backend/os/Makefile.am b/backend/os/Makefile.am
index bd74aad..2a9f019 100644
--- a/backend/os/Makefile.am
+++ b/backend/os/Makefile.am
@@ -1 +1,16 @@
+SUBDIRS = bfd
+
+noinst_LTLIBRARIES = libmonodebuggerbfdglue.la
+
+libmonodebuggerbfdglue_la_SOURCES = \
+ bfdglue.c \
+ bfdglue.h
+
+libmonodebuggerbfdglue_la_LIBADD = bfd/opcodes/libopcodes.la bfd/libbfd.la @BASE_DEPENDENCIES_LIBS@
+libmonodebuggerbfdglue_la_LDFLAGS = -no-undefined -module -export-dynamic -shared
+
+INCLUDES = -I$(srcdir)/bfd -I$(srcdir)/bfd/include -I$(srcdir)/bfd/opcodes @BASE_DEPENDENCIES_CFLAGS@
+
+CLEANFILES = lib*.a lib*.dll
+
EXTRA_DIST = $(srcdir)/*.cs
diff --git a/backend/os/Makefile.in b/backend/os/Makefile.in
index 5d590f1..9bef215 100644
--- a/backend/os/Makefile.in
+++ b/backend/os/Makefile.in
@@ -13,6 +13,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
+
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -42,8 +43,42 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libmonodebuggerbfdglue_la_DEPENDENCIES = bfd/opcodes/libopcodes.la \
+ bfd/libbfd.la
+am_libmonodebuggerbfdglue_la_OBJECTS = bfdglue.lo
+libmonodebuggerbfdglue_la_OBJECTS = \
+ $(am_libmonodebuggerbfdglue_la_OBJECTS)
+libmonodebuggerbfdglue_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libmonodebuggerbfdglue_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmonodebuggerbfdglue_la_SOURCES)
+DIST_SOURCES = $(libmonodebuggerbfdglue_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -117,6 +152,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
@@ -195,10 +231,21 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+SUBDIRS = bfd
+noinst_LTLIBRARIES = libmonodebuggerbfdglue.la
+libmonodebuggerbfdglue_la_SOURCES = \
+ bfdglue.c \
+ bfdglue.h
+
+libmonodebuggerbfdglue_la_LIBADD = bfd/opcodes/libopcodes.la bfd/libbfd.la @BASE_DEPENDENCIES_LIBS@
+libmonodebuggerbfdglue_la_LDFLAGS = -no-undefined -module -export-dynamic -shared
+INCLUDES = -I$(srcdir)/bfd -I$(srcdir)/bfd/include -I$(srcdir)/bfd/opcodes @BASE_DEPENDENCIES_CFLAGS@
+CLEANFILES = lib*.a lib*.dll
EXTRA_DIST = $(srcdir)/*.cs
-all: all-am
+all: all-recursive
.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@@ -229,17 +276,181 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmonodebuggerbfdglue.la: $(libmonodebuggerbfdglue_la_OBJECTS) $(libmonodebuggerbfdglue_la_DEPENDENCIES)
+ $(libmonodebuggerbfdglue_la_LINK) $(libmonodebuggerbfdglue_la_OBJECTS) $(libmonodebuggerbfdglue_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bfdglue.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
tags: TAGS
-TAGS:
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
ctags: CTAGS
-CTAGS:
-
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -267,19 +478,37 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-am
+installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -288,6 +517,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -295,72 +525,82 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
-clean-am: clean-generic clean-libtool mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
-distclean: distclean-am
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
-rm -f Makefile
-distclean-am: clean-am distclean-generic
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
-info: info-am
+info: info-recursive
info-am:
install-data-am:
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
install-exec-am:
-install-html: install-html-am
+install-html: install-html-recursive
-install-info: install-info-am
+install-info: install-info-recursive
install-man:
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
-install-ps: install-ps-am
+install-ps: install-ps-recursive
installcheck-am:
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
-pdf: pdf-am
+pdf: pdf-recursive
pdf-am:
-ps: ps-am
+ps: ps-recursive
ps-am:
uninstall-am:
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/backend/os/OperatingSystemBackend.cs b/backend/os/OperatingSystemBackend.cs
index ce4882e..58f4889 100644
--- a/backend/os/OperatingSystemBackend.cs
+++ b/backend/os/OperatingSystemBackend.cs
@@ -5,9 +5,9 @@ namespace Mono.Debugger.Backend
{
internal abstract class OperatingSystemBackend : DebuggerMarshalByRefObject, IDisposable
{
- public readonly Process Process;
+ public readonly ProcessServant Process;
- protected OperatingSystemBackend (Process process)
+ protected OperatingSystemBackend (ProcessServant process)
{
this.Process = process;
}
diff --git a/backend/os/WindowsOperatingSystem.cs b/backend/os/WindowsOperatingSystem.cs
index 60cfbfd..a7dac4e 100644
--- a/backend/os/WindowsOperatingSystem.cs
+++ b/backend/os/WindowsOperatingSystem.cs
@@ -9,7 +9,7 @@ namespace Mono.Debugger.Backend
internal class WindowsOperatingSystem : OperatingSystemBackend
{
- public WindowsOperatingSystem(Process process)
+ public WindowsOperatingSystem(ProcessServant process)
: base (process)
{
}
diff --git a/sysdeps/bfd/COPYING b/backend/os/bfd/COPYING
similarity index 100%
rename from sysdeps/bfd/COPYING
rename to backend/os/bfd/COPYING
diff --git a/sysdeps/bfd/Makefile.am b/backend/os/bfd/Makefile.am
similarity index 100%
rename from sysdeps/bfd/Makefile.am
rename to backend/os/bfd/Makefile.am
diff --git a/backend/os/bfd/Makefile.in b/backend/os/bfd/Makefile.in
new file mode 100644
index 0000000..b6fc40c
--- /dev/null
+++ b/backend/os/bfd/Makefile.in
@@ -0,0 +1,726 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libbfd_la_DEPENDENCIES = libiberty/libiberty.la
+am__libbfd_la_SOURCES_DIST = elf32-i386.c elf32.c elf.c elflink.c \
+ elf-strtab.c elf-eh-frame.c dwarf1.c i386linux.c aout32.c \
+ efi-app-ia32.c peigen.c cofflink.c elf32-gen.c cpu-i386.c \
+ pe-i386.c pei-i386.c trad-core.c mach-o.c pef.c xsym.c \
+ elf64-x86-64.c elf64.c elf64-gen.c archive64.c rs6000-core.c \
+ cpu-rs6000.c cpu-powerpc.c archive.c archures.c bfd.c cache.c \
+ coffgen.c corefile.c format.c init.c libbfd.c opncls.c reloc.c \
+ section.c syms.c targets.c hash.c linker.c srec.c binary.c \
+ tekhex.c ihex.c stabs.c stab-syms.c merge.c dwarf2.c bfdio.c \
+ simple.c
+am__objects_1 = elf32-i386.lo elf32.lo elf.lo elflink.lo elf-strtab.lo \
+ elf-eh-frame.lo dwarf1.lo i386linux.lo aout32.lo \
+ efi-app-ia32.lo peigen.lo cofflink.lo elf32-gen.lo cpu-i386.lo \
+ pe-i386.lo pei-i386.lo trad-core.lo
+am__objects_2 = mach-o.lo pef.lo xsym.lo cpu-i386.lo
+am__objects_3 = elf64-x86-64.lo elf64.lo elf32-i386.lo elf32.lo elf.lo \
+ elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo \
+ i386linux.lo aout32.lo efi-app-ia32.lo peigen.lo cofflink.lo \
+ elf64-gen.lo elf32-gen.lo cpu-i386.lo pe-i386.lo pei-i386.lo \
+ trad-core.lo archive64.lo
+am__objects_4 = mach-o.lo pef.lo rs6000-core.lo xsym.lo cpu-rs6000.lo \
+ cpu-powerpc.lo
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at am__objects_5 = $(am__objects_1)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at am__objects_5 = $(am__objects_2)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at am__objects_5 = $(am__objects_3)
+ at BFD_TARGET_POWERPC_TRUE@am__objects_5 = $(am__objects_4) \
+ at BFD_TARGET_POWERPC_TRUE@ $(am__objects_1)
+am__objects_6 = archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
+ corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo \
+ section.lo syms.lo targets.lo hash.lo linker.lo srec.lo \
+ binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo \
+ dwarf2.lo bfdio.lo simple.lo
+am_libbfd_la_OBJECTS = $(am__objects_5) $(am__objects_6)
+libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
+libbfd_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libbfd_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libbfd_la_SOURCES)
+DIST_SOURCES = $(am__libbfd_la_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = include hosts libiberty opcodes
+INCDIR = $(srcdir)/include
+CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
+noinst_LTLIBRARIES = libbfd.la
+AM_CFLAGS = $(WARN_CFLAGS)
+powerpc_backend = mach-o.c pef.c rs6000-core.c xsym.c cpu-rs6000.c cpu-powerpc.c
+powerpc_vec_defines = -DHAVE_mach_o_be_vec -DHAVE_mach_o_le_vec -DHAVE_mach_o_fat_vec -DHAVE_pef_vec -DHAVE_pef_xlib_vec -DHAVE_sym_vec
+i386_linux_backend = elf32-i386.c elf32.c elf.c elflink.c elf-strtab.c elf-eh-frame.c dwarf1.c i386linux.c aout32.c efi-app-ia32.c peigen.c cofflink.c elf32-gen.c cpu-i386.c pe-i386.c pei-i386.c trad-core.c
+i386_linux_vec_defines = -DHAVE_bfd_elf32_i386_vec -DHAVE_i386linux_vec -DHAVE_bfd_efi_app_ia32_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DHAVE_i386pe_vec -DHAVE_i386pei_vec
+x86_64_linux_backend = elf64-x86-64.c elf64.c elf32-i386.c elf32.c elf.c elflink.c elf-strtab.c elf-eh-frame.c dwarf1.c i386linux.c aout32.c efi-app-ia32.c peigen.c cofflink.c elf64-gen.c elf32-gen.c cpu-i386.c pe-i386.c pei-i386.c trad-core.c archive64.c
+x86_64_linux_vec_defines = -DHAVE_bfd_elf64_x86_64_vec -DHAVE_bfd_elf32_i386_vec -DHAVE_i386linux_vec -DHAVE_bfd_efi_app_ia32_vec -DHAVE_bfd_elf64_little_generic_vec -DHAVE_bfd_elf64_big_generic_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec
+i386_mach_backend = mach-o.c pef.c xsym.c cpu-i386.c
+i386_mach_vec_defines = -DHAVE_mach_o_be_vec -DHAVE_mach_o_le_vec -DHAVE_mach_o_fat_vec -DHAVE_pef_vec -DHAVE_pef_xlib_vec -DHAVE_sym_vec
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at BFD_BACKEND = $(i386_linux_backend)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at BFD_BACKEND = $(i386_mach_backend)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at BFD_BACKEND = $(x86_64_linux_backend)
+ at BFD_TARGET_POWERPC_TRUE@BFD_BACKEND = $(powerpc_backend) $(i386_linux_backend)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at TDEFAULTS = -DDEFAULT_VECTOR=bfd_elf32_i386_vec -DSELECT_VECS='&bfd_elf32_i386_vec,&i386linux_vec,&bfd_efi_app_ia32_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec,&i386pe_vec,&i386pei_vec' -DSELECT_ARCHITECTURES='&bfd_i386_arch' $(i386_linux_vec_defines)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at TDEFAULTS = -DDEFAULT_VECTOR=mach_o_be_vec -DSELECT_VECS='&mach_o_be_vec,&mach_o_le_vec,&mach_o_fat_vec,&pef_vec,&pef_xlib_vec,&sym_vec' -DSELECT_ARCHITECTURES='&bfd_i386_arch' $(i386_mach_vec_defines)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at TDEFAULTS = -DDEFAULT_VECTOR=bfd_elf64_x86_64_vec -DSELECT_VECS='&bfd_elf64_x86_64_vec,&bfd_elf32_i386_vec,&i386linux_vec,&bfd_efi_app_ia32_vec,&bfd_elf64_little_generic_vec,&bfd_elf64_big_generic_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec' -DSELECT_ARCHITECTURES='&bfd_i386_arch' $(x86_64_linux_vec_defines)
+ at BFD_TARGET_POWERPC_TRUE@TDEFAULTS = -DDEFAULT_VECTOR=mach_o_be_vec -DSELECT_VECS='&mach_o_be_vec,&mach_o_le_vec,&mach_o_fat_vec,&pef_vec,&pef_xlib_vec,&sym_vec,&bfd_elf32_i386_vec,&i386linux_vec,&bfd_efi_app_ia32_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec,&i386pe_vec,&i386pei_vec' -DSELECT_ARCHITECTURES='&bfd_powerpc_arch,&bfd_rs6000_arch,&bfd_i386_arch' $(powerpc_vec_defines) $(i386_linux_vec_defines)
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at bfd_cflags = -DTRAD_CORE
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at bfd_cflags =
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at bfd_cflags = -DTRAD_CORE -DBFD64
+ at BFD_TARGET_POWERPC_TRUE@bfd_cflags =
+INCLUDES = -D_GNU_SOURCE $(bfd_cflags) $(CSEARCH) $(CSWITCHES)
+SOURCE_FILES = \
+ archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
+ format.c init.c libbfd.c opncls.c reloc.c \
+ section.c syms.c targets.c hash.c linker.c \
+ srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
+ merge.c dwarf2.c bfdio.c simple.c
+
+libbfd_la_SOURCES = $(BFD_BACKEND) $(SOURCE_FILES)
+libbfd_la_LDFLAGS = -export-dynamic
+libbfd_la_LIBADD = libiberty/libiberty.la
+EXTRA_DIST = coff-i386.c peigen.c aout-target.h aoutx.h bfd.h bfd-in2.h bfd-in.h coffcode.h \
+ coffswap.h elf32-target.h elf-bfd.h elfcode.h elfcore.h elflink.h genlink.h libaout.h \
+ libbfd.h libbfd-in.h libcoff.h libcoff-in.h libecoff.h libpei.h peicode.h sysdep.h \
+ targmatch.h version.h bfdver.h elf64-target.h
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
+ $(libbfd_la_LINK) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aout32.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/archive.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/archive64.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/archures.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bfd.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bfdio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/binary.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cache.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/coffgen.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cofflink.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/corefile.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu-i386.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu-powerpc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu-rs6000.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dwarf1.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dwarf2.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/efi-app-ia32.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf-eh-frame.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf-strtab.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf32-gen.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf32-i386.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf32.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf64-gen.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf64-x86-64.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf64.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elflink.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/format.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hash.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/i386linux.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ihex.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/init.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libbfd.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/linker.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mach-o.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/merge.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/opncls.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pe-i386.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pef.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pei-i386.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/peigen.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/reloc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rs6000-core.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/section.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/srec.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stab-syms.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stabs.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/syms.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/targets.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tekhex.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trad-core.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xsym.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+# When compiling archures.c and targets.c, supply the default target
+# info from configure.
+
+targets.lo: targets.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
+
+archures.lo: archures.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/aout-target.h b/backend/os/bfd/aout-target.h
similarity index 100%
rename from sysdeps/bfd/aout-target.h
rename to backend/os/bfd/aout-target.h
diff --git a/sysdeps/bfd/aout32.c b/backend/os/bfd/aout32.c
similarity index 100%
rename from sysdeps/bfd/aout32.c
rename to backend/os/bfd/aout32.c
diff --git a/sysdeps/bfd/aoutx.h b/backend/os/bfd/aoutx.h
similarity index 100%
rename from sysdeps/bfd/aoutx.h
rename to backend/os/bfd/aoutx.h
diff --git a/sysdeps/bfd/archive.c b/backend/os/bfd/archive.c
similarity index 100%
rename from sysdeps/bfd/archive.c
rename to backend/os/bfd/archive.c
diff --git a/sysdeps/bfd/archive64.c b/backend/os/bfd/archive64.c
similarity index 100%
rename from sysdeps/bfd/archive64.c
rename to backend/os/bfd/archive64.c
diff --git a/sysdeps/bfd/archures.c b/backend/os/bfd/archures.c
similarity index 100%
rename from sysdeps/bfd/archures.c
rename to backend/os/bfd/archures.c
diff --git a/sysdeps/bfd/bfd-in.h b/backend/os/bfd/bfd-in.h
similarity index 100%
rename from sysdeps/bfd/bfd-in.h
rename to backend/os/bfd/bfd-in.h
diff --git a/sysdeps/bfd/bfd-in2.h b/backend/os/bfd/bfd-in2.h
similarity index 100%
rename from sysdeps/bfd/bfd-in2.h
rename to backend/os/bfd/bfd-in2.h
diff --git a/sysdeps/bfd/bfd.c b/backend/os/bfd/bfd.c
similarity index 100%
rename from sysdeps/bfd/bfd.c
rename to backend/os/bfd/bfd.c
diff --git a/sysdeps/bfd/bfd.h b/backend/os/bfd/bfd.h
similarity index 100%
rename from sysdeps/bfd/bfd.h
rename to backend/os/bfd/bfd.h
diff --git a/sysdeps/bfd/bfdio.c b/backend/os/bfd/bfdio.c
similarity index 100%
rename from sysdeps/bfd/bfdio.c
rename to backend/os/bfd/bfdio.c
diff --git a/sysdeps/bfd/bfdver.h b/backend/os/bfd/bfdver.h
similarity index 100%
rename from sysdeps/bfd/bfdver.h
rename to backend/os/bfd/bfdver.h
diff --git a/sysdeps/bfd/binary.c b/backend/os/bfd/binary.c
similarity index 100%
rename from sysdeps/bfd/binary.c
rename to backend/os/bfd/binary.c
diff --git a/sysdeps/bfd/cache.c b/backend/os/bfd/cache.c
similarity index 100%
rename from sysdeps/bfd/cache.c
rename to backend/os/bfd/cache.c
diff --git a/sysdeps/bfd/coff-i386.c b/backend/os/bfd/coff-i386.c
similarity index 100%
rename from sysdeps/bfd/coff-i386.c
rename to backend/os/bfd/coff-i386.c
diff --git a/sysdeps/bfd/coffcode.h b/backend/os/bfd/coffcode.h
similarity index 100%
rename from sysdeps/bfd/coffcode.h
rename to backend/os/bfd/coffcode.h
diff --git a/sysdeps/bfd/coffgen.c b/backend/os/bfd/coffgen.c
similarity index 100%
rename from sysdeps/bfd/coffgen.c
rename to backend/os/bfd/coffgen.c
diff --git a/sysdeps/bfd/cofflink.c b/backend/os/bfd/cofflink.c
similarity index 100%
rename from sysdeps/bfd/cofflink.c
rename to backend/os/bfd/cofflink.c
diff --git a/sysdeps/bfd/coffswap.h b/backend/os/bfd/coffswap.h
similarity index 100%
rename from sysdeps/bfd/coffswap.h
rename to backend/os/bfd/coffswap.h
diff --git a/sysdeps/bfd/corefile.c b/backend/os/bfd/corefile.c
similarity index 100%
rename from sysdeps/bfd/corefile.c
rename to backend/os/bfd/corefile.c
diff --git a/sysdeps/bfd/cpu-i386.c b/backend/os/bfd/cpu-i386.c
similarity index 100%
rename from sysdeps/bfd/cpu-i386.c
rename to backend/os/bfd/cpu-i386.c
diff --git a/sysdeps/bfd/cpu-powerpc.c b/backend/os/bfd/cpu-powerpc.c
similarity index 100%
rename from sysdeps/bfd/cpu-powerpc.c
rename to backend/os/bfd/cpu-powerpc.c
diff --git a/sysdeps/bfd/cpu-rs6000.c b/backend/os/bfd/cpu-rs6000.c
similarity index 100%
rename from sysdeps/bfd/cpu-rs6000.c
rename to backend/os/bfd/cpu-rs6000.c
diff --git a/sysdeps/bfd/dwarf1.c b/backend/os/bfd/dwarf1.c
similarity index 100%
rename from sysdeps/bfd/dwarf1.c
rename to backend/os/bfd/dwarf1.c
diff --git a/sysdeps/bfd/dwarf2.c b/backend/os/bfd/dwarf2.c
similarity index 100%
rename from sysdeps/bfd/dwarf2.c
rename to backend/os/bfd/dwarf2.c
diff --git a/sysdeps/bfd/efi-app-ia32.c b/backend/os/bfd/efi-app-ia32.c
similarity index 100%
rename from sysdeps/bfd/efi-app-ia32.c
rename to backend/os/bfd/efi-app-ia32.c
diff --git a/sysdeps/bfd/elf-bfd.h b/backend/os/bfd/elf-bfd.h
similarity index 100%
rename from sysdeps/bfd/elf-bfd.h
rename to backend/os/bfd/elf-bfd.h
diff --git a/sysdeps/bfd/elf-eh-frame.c b/backend/os/bfd/elf-eh-frame.c
similarity index 100%
rename from sysdeps/bfd/elf-eh-frame.c
rename to backend/os/bfd/elf-eh-frame.c
diff --git a/sysdeps/bfd/elf-strtab.c b/backend/os/bfd/elf-strtab.c
similarity index 100%
rename from sysdeps/bfd/elf-strtab.c
rename to backend/os/bfd/elf-strtab.c
diff --git a/sysdeps/bfd/elf.c b/backend/os/bfd/elf.c
similarity index 100%
rename from sysdeps/bfd/elf.c
rename to backend/os/bfd/elf.c
diff --git a/sysdeps/bfd/elf32-gen.c b/backend/os/bfd/elf32-gen.c
similarity index 100%
rename from sysdeps/bfd/elf32-gen.c
rename to backend/os/bfd/elf32-gen.c
diff --git a/sysdeps/bfd/elf32-i386.c b/backend/os/bfd/elf32-i386.c
similarity index 100%
rename from sysdeps/bfd/elf32-i386.c
rename to backend/os/bfd/elf32-i386.c
diff --git a/sysdeps/bfd/elf32-target.h b/backend/os/bfd/elf32-target.h
similarity index 100%
rename from sysdeps/bfd/elf32-target.h
rename to backend/os/bfd/elf32-target.h
diff --git a/sysdeps/bfd/elf32.c b/backend/os/bfd/elf32.c
similarity index 100%
rename from sysdeps/bfd/elf32.c
rename to backend/os/bfd/elf32.c
diff --git a/sysdeps/bfd/elf64-gen.c b/backend/os/bfd/elf64-gen.c
similarity index 100%
rename from sysdeps/bfd/elf64-gen.c
rename to backend/os/bfd/elf64-gen.c
diff --git a/sysdeps/bfd/elf64-target.h b/backend/os/bfd/elf64-target.h
similarity index 100%
rename from sysdeps/bfd/elf64-target.h
rename to backend/os/bfd/elf64-target.h
diff --git a/sysdeps/bfd/elf64-x86-64.c b/backend/os/bfd/elf64-x86-64.c
similarity index 100%
rename from sysdeps/bfd/elf64-x86-64.c
rename to backend/os/bfd/elf64-x86-64.c
diff --git a/sysdeps/bfd/elf64.c b/backend/os/bfd/elf64.c
similarity index 100%
rename from sysdeps/bfd/elf64.c
rename to backend/os/bfd/elf64.c
diff --git a/sysdeps/bfd/elfcode.h b/backend/os/bfd/elfcode.h
similarity index 100%
rename from sysdeps/bfd/elfcode.h
rename to backend/os/bfd/elfcode.h
diff --git a/sysdeps/bfd/elfcore.h b/backend/os/bfd/elfcore.h
similarity index 100%
rename from sysdeps/bfd/elfcore.h
rename to backend/os/bfd/elfcore.h
diff --git a/sysdeps/bfd/elflink.c b/backend/os/bfd/elflink.c
similarity index 100%
rename from sysdeps/bfd/elflink.c
rename to backend/os/bfd/elflink.c
diff --git a/sysdeps/bfd/elflink.h b/backend/os/bfd/elflink.h
similarity index 100%
rename from sysdeps/bfd/elflink.h
rename to backend/os/bfd/elflink.h
diff --git a/sysdeps/bfd/format.c b/backend/os/bfd/format.c
similarity index 100%
rename from sysdeps/bfd/format.c
rename to backend/os/bfd/format.c
diff --git a/sysdeps/bfd/genlink.h b/backend/os/bfd/genlink.h
similarity index 100%
rename from sysdeps/bfd/genlink.h
rename to backend/os/bfd/genlink.h
diff --git a/sysdeps/bfd/hash.c b/backend/os/bfd/hash.c
similarity index 100%
rename from sysdeps/bfd/hash.c
rename to backend/os/bfd/hash.c
diff --git a/sysdeps/bfd/hosts/Makefile.am b/backend/os/bfd/hosts/Makefile.am
similarity index 100%
rename from sysdeps/bfd/hosts/Makefile.am
rename to backend/os/bfd/hosts/Makefile.am
diff --git a/backend/os/bfd/hosts/Makefile.in b/backend/os/bfd/hosts/Makefile.in
new file mode 100644
index 0000000..bc15845
--- /dev/null
+++ b/backend/os/bfd/hosts/Makefile.in
@@ -0,0 +1,368 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/hosts
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = i386linux.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/hosts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/hosts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/hosts/i386linux.h b/backend/os/bfd/hosts/i386linux.h
similarity index 100%
rename from sysdeps/bfd/hosts/i386linux.h
rename to backend/os/bfd/hosts/i386linux.h
diff --git a/sysdeps/bfd/i386linux.c b/backend/os/bfd/i386linux.c
similarity index 100%
rename from sysdeps/bfd/i386linux.c
rename to backend/os/bfd/i386linux.c
diff --git a/sysdeps/bfd/ihex.c b/backend/os/bfd/ihex.c
similarity index 100%
rename from sysdeps/bfd/ihex.c
rename to backend/os/bfd/ihex.c
diff --git a/sysdeps/bfd/include/Makefile.am b/backend/os/bfd/include/Makefile.am
similarity index 100%
rename from sysdeps/bfd/include/Makefile.am
rename to backend/os/bfd/include/Makefile.am
diff --git a/backend/os/bfd/include/Makefile.in b/backend/os/bfd/include/Makefile.in
new file mode 100644
index 0000000..69b22fa
--- /dev/null
+++ b/backend/os/bfd/include/Makefile.in
@@ -0,0 +1,529 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/include
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = aout coff elf opcode
+EXTRA_DIST = ansidecl.h bfdlink.h dis-asm.h filenames.h fnmatch.h fopen-same.h hashtab.h \
+ libiberty.h objalloc.h safe-ctype.h symcat.h
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/include/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/include/ansidecl.h b/backend/os/bfd/include/ansidecl.h
similarity index 100%
rename from sysdeps/bfd/include/ansidecl.h
rename to backend/os/bfd/include/ansidecl.h
diff --git a/sysdeps/bfd/include/aout/Makefile.am b/backend/os/bfd/include/aout/Makefile.am
similarity index 100%
rename from sysdeps/bfd/include/aout/Makefile.am
rename to backend/os/bfd/include/aout/Makefile.am
diff --git a/backend/os/bfd/include/aout/Makefile.in b/backend/os/bfd/include/aout/Makefile.in
new file mode 100644
index 0000000..eae967e
--- /dev/null
+++ b/backend/os/bfd/include/aout/Makefile.in
@@ -0,0 +1,368 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/include/aout
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = stab.def aout64.h ar.h ranlib.h stab_gnu.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/include/aout/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/include/aout/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/include/aout/aout64.h b/backend/os/bfd/include/aout/aout64.h
similarity index 100%
rename from sysdeps/bfd/include/aout/aout64.h
rename to backend/os/bfd/include/aout/aout64.h
diff --git a/sysdeps/bfd/include/aout/ar.h b/backend/os/bfd/include/aout/ar.h
similarity index 100%
rename from sysdeps/bfd/include/aout/ar.h
rename to backend/os/bfd/include/aout/ar.h
diff --git a/sysdeps/bfd/include/aout/ranlib.h b/backend/os/bfd/include/aout/ranlib.h
similarity index 100%
rename from sysdeps/bfd/include/aout/ranlib.h
rename to backend/os/bfd/include/aout/ranlib.h
diff --git a/sysdeps/bfd/include/aout/stab.def b/backend/os/bfd/include/aout/stab.def
similarity index 100%
rename from sysdeps/bfd/include/aout/stab.def
rename to backend/os/bfd/include/aout/stab.def
diff --git a/sysdeps/bfd/include/aout/stab_gnu.h b/backend/os/bfd/include/aout/stab_gnu.h
similarity index 100%
rename from sysdeps/bfd/include/aout/stab_gnu.h
rename to backend/os/bfd/include/aout/stab_gnu.h
diff --git a/sysdeps/bfd/include/bfdlink.h b/backend/os/bfd/include/bfdlink.h
similarity index 100%
rename from sysdeps/bfd/include/bfdlink.h
rename to backend/os/bfd/include/bfdlink.h
diff --git a/sysdeps/bfd/include/coff/Makefile.am b/backend/os/bfd/include/coff/Makefile.am
similarity index 100%
rename from sysdeps/bfd/include/coff/Makefile.am
rename to backend/os/bfd/include/coff/Makefile.am
diff --git a/backend/os/bfd/include/coff/Makefile.in b/backend/os/bfd/include/coff/Makefile.in
new file mode 100644
index 0000000..a8635ef
--- /dev/null
+++ b/backend/os/bfd/include/coff/Makefile.in
@@ -0,0 +1,368 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/include/coff
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = ecoff.h external.h i386.h internal.h pe.h sym.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/include/coff/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/include/coff/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/include/coff/ecoff.h b/backend/os/bfd/include/coff/ecoff.h
similarity index 100%
rename from sysdeps/bfd/include/coff/ecoff.h
rename to backend/os/bfd/include/coff/ecoff.h
diff --git a/sysdeps/bfd/include/coff/external.h b/backend/os/bfd/include/coff/external.h
similarity index 100%
rename from sysdeps/bfd/include/coff/external.h
rename to backend/os/bfd/include/coff/external.h
diff --git a/sysdeps/bfd/include/coff/i386.h b/backend/os/bfd/include/coff/i386.h
similarity index 100%
rename from sysdeps/bfd/include/coff/i386.h
rename to backend/os/bfd/include/coff/i386.h
diff --git a/sysdeps/bfd/include/coff/internal.h b/backend/os/bfd/include/coff/internal.h
similarity index 100%
rename from sysdeps/bfd/include/coff/internal.h
rename to backend/os/bfd/include/coff/internal.h
diff --git a/sysdeps/bfd/include/coff/pe.h b/backend/os/bfd/include/coff/pe.h
similarity index 100%
rename from sysdeps/bfd/include/coff/pe.h
rename to backend/os/bfd/include/coff/pe.h
diff --git a/sysdeps/bfd/include/coff/sym.h b/backend/os/bfd/include/coff/sym.h
similarity index 100%
rename from sysdeps/bfd/include/coff/sym.h
rename to backend/os/bfd/include/coff/sym.h
diff --git a/sysdeps/bfd/include/dis-asm.h b/backend/os/bfd/include/dis-asm.h
similarity index 100%
rename from sysdeps/bfd/include/dis-asm.h
rename to backend/os/bfd/include/dis-asm.h
diff --git a/sysdeps/bfd/include/elf/Makefile.am b/backend/os/bfd/include/elf/Makefile.am
similarity index 100%
rename from sysdeps/bfd/include/elf/Makefile.am
rename to backend/os/bfd/include/elf/Makefile.am
diff --git a/backend/os/bfd/include/elf/Makefile.in b/backend/os/bfd/include/elf/Makefile.in
new file mode 100644
index 0000000..8cec5f1
--- /dev/null
+++ b/backend/os/bfd/include/elf/Makefile.in
@@ -0,0 +1,368 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/include/elf
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = common.h dwarf2.h dwarf.h external.h i386.h internal.h reloc-macros.h x86-64.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/include/elf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/include/elf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/include/elf/common.h b/backend/os/bfd/include/elf/common.h
similarity index 100%
rename from sysdeps/bfd/include/elf/common.h
rename to backend/os/bfd/include/elf/common.h
diff --git a/sysdeps/bfd/include/elf/dwarf.h b/backend/os/bfd/include/elf/dwarf.h
similarity index 100%
rename from sysdeps/bfd/include/elf/dwarf.h
rename to backend/os/bfd/include/elf/dwarf.h
diff --git a/sysdeps/bfd/include/elf/dwarf2.h b/backend/os/bfd/include/elf/dwarf2.h
similarity index 100%
rename from sysdeps/bfd/include/elf/dwarf2.h
rename to backend/os/bfd/include/elf/dwarf2.h
diff --git a/sysdeps/bfd/include/elf/external.h b/backend/os/bfd/include/elf/external.h
similarity index 100%
rename from sysdeps/bfd/include/elf/external.h
rename to backend/os/bfd/include/elf/external.h
diff --git a/sysdeps/bfd/include/elf/i386.h b/backend/os/bfd/include/elf/i386.h
similarity index 100%
rename from sysdeps/bfd/include/elf/i386.h
rename to backend/os/bfd/include/elf/i386.h
diff --git a/sysdeps/bfd/include/elf/internal.h b/backend/os/bfd/include/elf/internal.h
similarity index 100%
rename from sysdeps/bfd/include/elf/internal.h
rename to backend/os/bfd/include/elf/internal.h
diff --git a/sysdeps/bfd/include/elf/reloc-macros.h b/backend/os/bfd/include/elf/reloc-macros.h
similarity index 100%
rename from sysdeps/bfd/include/elf/reloc-macros.h
rename to backend/os/bfd/include/elf/reloc-macros.h
diff --git a/sysdeps/bfd/include/elf/x86-64.h b/backend/os/bfd/include/elf/x86-64.h
similarity index 100%
rename from sysdeps/bfd/include/elf/x86-64.h
rename to backend/os/bfd/include/elf/x86-64.h
diff --git a/sysdeps/bfd/include/filenames.h b/backend/os/bfd/include/filenames.h
similarity index 100%
rename from sysdeps/bfd/include/filenames.h
rename to backend/os/bfd/include/filenames.h
diff --git a/sysdeps/bfd/include/fnmatch.h b/backend/os/bfd/include/fnmatch.h
similarity index 100%
rename from sysdeps/bfd/include/fnmatch.h
rename to backend/os/bfd/include/fnmatch.h
diff --git a/sysdeps/bfd/include/fopen-same.h b/backend/os/bfd/include/fopen-same.h
similarity index 100%
rename from sysdeps/bfd/include/fopen-same.h
rename to backend/os/bfd/include/fopen-same.h
diff --git a/sysdeps/bfd/include/hashtab.h b/backend/os/bfd/include/hashtab.h
similarity index 100%
rename from sysdeps/bfd/include/hashtab.h
rename to backend/os/bfd/include/hashtab.h
diff --git a/sysdeps/bfd/include/libiberty.h b/backend/os/bfd/include/libiberty.h
similarity index 100%
rename from sysdeps/bfd/include/libiberty.h
rename to backend/os/bfd/include/libiberty.h
diff --git a/sysdeps/bfd/include/objalloc.h b/backend/os/bfd/include/objalloc.h
similarity index 100%
rename from sysdeps/bfd/include/objalloc.h
rename to backend/os/bfd/include/objalloc.h
diff --git a/sysdeps/bfd/include/opcode/Makefile.am b/backend/os/bfd/include/opcode/Makefile.am
similarity index 100%
rename from sysdeps/bfd/include/opcode/Makefile.am
rename to backend/os/bfd/include/opcode/Makefile.am
diff --git a/backend/os/bfd/include/opcode/Makefile.in b/backend/os/bfd/include/opcode/Makefile.in
new file mode 100644
index 0000000..e75fce9
--- /dev/null
+++ b/backend/os/bfd/include/opcode/Makefile.in
@@ -0,0 +1,368 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/include/opcode
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = ppc.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/include/opcode/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/include/opcode/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/include/opcode/ppc.h b/backend/os/bfd/include/opcode/ppc.h
similarity index 100%
rename from sysdeps/bfd/include/opcode/ppc.h
rename to backend/os/bfd/include/opcode/ppc.h
diff --git a/sysdeps/bfd/include/safe-ctype.h b/backend/os/bfd/include/safe-ctype.h
similarity index 100%
rename from sysdeps/bfd/include/safe-ctype.h
rename to backend/os/bfd/include/safe-ctype.h
diff --git a/sysdeps/bfd/include/symcat.h b/backend/os/bfd/include/symcat.h
similarity index 100%
rename from sysdeps/bfd/include/symcat.h
rename to backend/os/bfd/include/symcat.h
diff --git a/sysdeps/bfd/init.c b/backend/os/bfd/init.c
similarity index 100%
rename from sysdeps/bfd/init.c
rename to backend/os/bfd/init.c
diff --git a/sysdeps/bfd/libaout.h b/backend/os/bfd/libaout.h
similarity index 100%
rename from sysdeps/bfd/libaout.h
rename to backend/os/bfd/libaout.h
diff --git a/sysdeps/bfd/libbfd-in.h b/backend/os/bfd/libbfd-in.h
similarity index 100%
rename from sysdeps/bfd/libbfd-in.h
rename to backend/os/bfd/libbfd-in.h
diff --git a/sysdeps/bfd/libbfd.c b/backend/os/bfd/libbfd.c
similarity index 100%
rename from sysdeps/bfd/libbfd.c
rename to backend/os/bfd/libbfd.c
diff --git a/sysdeps/bfd/libbfd.h b/backend/os/bfd/libbfd.h
similarity index 100%
rename from sysdeps/bfd/libbfd.h
rename to backend/os/bfd/libbfd.h
diff --git a/sysdeps/bfd/libcoff-in.h b/backend/os/bfd/libcoff-in.h
similarity index 100%
rename from sysdeps/bfd/libcoff-in.h
rename to backend/os/bfd/libcoff-in.h
diff --git a/sysdeps/bfd/libcoff.h b/backend/os/bfd/libcoff.h
similarity index 100%
rename from sysdeps/bfd/libcoff.h
rename to backend/os/bfd/libcoff.h
diff --git a/sysdeps/bfd/libecoff.h b/backend/os/bfd/libecoff.h
similarity index 100%
rename from sysdeps/bfd/libecoff.h
rename to backend/os/bfd/libecoff.h
diff --git a/sysdeps/bfd/libiberty/Makefile.am b/backend/os/bfd/libiberty/Makefile.am
similarity index 100%
rename from sysdeps/bfd/libiberty/Makefile.am
rename to backend/os/bfd/libiberty/Makefile.am
diff --git a/backend/os/bfd/libiberty/Makefile.in b/backend/os/bfd/libiberty/Makefile.in
new file mode 100644
index 0000000..2a1dc9a
--- /dev/null
+++ b/backend/os/bfd/libiberty/Makefile.in
@@ -0,0 +1,499 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/libiberty
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libiberty_la_LIBADD =
+am_libiberty_la_OBJECTS = concat.lo hashtab.lo hex.lo objalloc.lo \
+ safe-ctype.lo xexit.lo xmalloc.lo xstrerror.lo fnmatch.lo \
+ basename.lo xstrdup.lo
+libiberty_la_OBJECTS = $(am_libiberty_la_OBJECTS)
+libiberty_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libiberty_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libiberty_la_SOURCES)
+DIST_SOURCES = $(libiberty_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CFLAGS = $(WARN_CFLAGS)
+INCLUDES = -D_GNU_SOURCE -I$(srcdir)/../include
+noinst_LTLIBRARIES = libiberty.la
+libiberty_la_SOURCES = \
+ concat.c hashtab.c hex.c objalloc.c safe-ctype.c \
+ xexit.c xmalloc.c xstrerror.c fnmatch.c basename.c \
+ xstrdup.c
+
+libiberty_la_LDFLAGS = -export-dynamic
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/libiberty/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/libiberty/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libiberty.la: $(libiberty_la_OBJECTS) $(libiberty_la_DEPENDENCIES)
+ $(libiberty_la_LINK) $(libiberty_la_OBJECTS) $(libiberty_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/basename.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/concat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fnmatch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hashtab.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hex.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/objalloc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/safe-ctype.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xexit.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmalloc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xstrdup.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xstrerror.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/libiberty/basename.c b/backend/os/bfd/libiberty/basename.c
similarity index 100%
rename from sysdeps/bfd/libiberty/basename.c
rename to backend/os/bfd/libiberty/basename.c
diff --git a/sysdeps/bfd/libiberty/concat.c b/backend/os/bfd/libiberty/concat.c
similarity index 100%
rename from sysdeps/bfd/libiberty/concat.c
rename to backend/os/bfd/libiberty/concat.c
diff --git a/sysdeps/bfd/libiberty/fnmatch.c b/backend/os/bfd/libiberty/fnmatch.c
similarity index 100%
rename from sysdeps/bfd/libiberty/fnmatch.c
rename to backend/os/bfd/libiberty/fnmatch.c
diff --git a/sysdeps/bfd/libiberty/hashtab.c b/backend/os/bfd/libiberty/hashtab.c
similarity index 100%
rename from sysdeps/bfd/libiberty/hashtab.c
rename to backend/os/bfd/libiberty/hashtab.c
diff --git a/sysdeps/bfd/libiberty/hex.c b/backend/os/bfd/libiberty/hex.c
similarity index 100%
rename from sysdeps/bfd/libiberty/hex.c
rename to backend/os/bfd/libiberty/hex.c
diff --git a/sysdeps/bfd/libiberty/objalloc.c b/backend/os/bfd/libiberty/objalloc.c
similarity index 100%
rename from sysdeps/bfd/libiberty/objalloc.c
rename to backend/os/bfd/libiberty/objalloc.c
diff --git a/sysdeps/bfd/libiberty/safe-ctype.c b/backend/os/bfd/libiberty/safe-ctype.c
similarity index 100%
rename from sysdeps/bfd/libiberty/safe-ctype.c
rename to backend/os/bfd/libiberty/safe-ctype.c
diff --git a/sysdeps/bfd/libiberty/xexit.c b/backend/os/bfd/libiberty/xexit.c
similarity index 100%
rename from sysdeps/bfd/libiberty/xexit.c
rename to backend/os/bfd/libiberty/xexit.c
diff --git a/sysdeps/bfd/libiberty/xmalloc.c b/backend/os/bfd/libiberty/xmalloc.c
similarity index 100%
rename from sysdeps/bfd/libiberty/xmalloc.c
rename to backend/os/bfd/libiberty/xmalloc.c
diff --git a/sysdeps/bfd/libiberty/xstrdup.c b/backend/os/bfd/libiberty/xstrdup.c
similarity index 100%
rename from sysdeps/bfd/libiberty/xstrdup.c
rename to backend/os/bfd/libiberty/xstrdup.c
diff --git a/sysdeps/bfd/libiberty/xstrerror.c b/backend/os/bfd/libiberty/xstrerror.c
similarity index 100%
rename from sysdeps/bfd/libiberty/xstrerror.c
rename to backend/os/bfd/libiberty/xstrerror.c
diff --git a/sysdeps/bfd/libpei.h b/backend/os/bfd/libpei.h
similarity index 100%
rename from sysdeps/bfd/libpei.h
rename to backend/os/bfd/libpei.h
diff --git a/sysdeps/bfd/linker.c b/backend/os/bfd/linker.c
similarity index 100%
rename from sysdeps/bfd/linker.c
rename to backend/os/bfd/linker.c
diff --git a/sysdeps/bfd/mach-o.c b/backend/os/bfd/mach-o.c
similarity index 100%
rename from sysdeps/bfd/mach-o.c
rename to backend/os/bfd/mach-o.c
diff --git a/sysdeps/bfd/merge.c b/backend/os/bfd/merge.c
similarity index 100%
rename from sysdeps/bfd/merge.c
rename to backend/os/bfd/merge.c
diff --git a/sysdeps/bfd/opcodes/Makefile.am b/backend/os/bfd/opcodes/Makefile.am
similarity index 100%
rename from sysdeps/bfd/opcodes/Makefile.am
rename to backend/os/bfd/opcodes/Makefile.am
diff --git a/backend/os/bfd/opcodes/Makefile.in b/backend/os/bfd/opcodes/Makefile.in
new file mode 100644
index 0000000..da53401
--- /dev/null
+++ b/backend/os/bfd/opcodes/Makefile.in
@@ -0,0 +1,500 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/os/bfd/opcodes
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libopcodes_la_LIBADD =
+am__libopcodes_la_SOURCES_DIST = dis-buf.c disassemble.c i386-dis.c \
+ ppc-dis.c ppc-opc.c
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE at am__objects_1 = i386-dis.lo
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at am__objects_1 = \
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE@ i386-dis.lo
+ at BFD_TARGET_POWERPC_TRUE@am__objects_1 = i386-dis.lo ppc-dis.lo \
+ at BFD_TARGET_POWERPC_TRUE@ ppc-opc.lo
+am_libopcodes_la_OBJECTS = dis-buf.lo disassemble.lo $(am__objects_1)
+libopcodes_la_OBJECTS = $(am_libopcodes_la_OBJECTS)
+libopcodes_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libopcodes_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libopcodes_la_SOURCES)
+DIST_SOURCES = $(am__libopcodes_la_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LTLIBRARIES = libopcodes.la
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE at arch_cflags = -DARCH_i386
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at arch_cflags = -DARCH_i386 -DBFD64
+ at BFD_TARGET_POWERPC_TRUE@arch_cflags = -DARCH_powerpc -DARCH_i386
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE at arch_sources = i386-dis.c
+ at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at arch_sources = i386-dis.c
+ at BFD_TARGET_POWERPC_TRUE@arch_sources = i386-dis.c ppc-dis.c ppc-opc.c
+INCLUDES = -D_GNU_SOURCE $(arch_cflags) -I$(srcdir)/.. -I$(srcdir)/../include
+libopcodes_la_SOURCES = dis-buf.c disassemble.c $(arch_sources)
+libopcodes_la_LDFLAGS = -export-dynamic
+EXTRA_DIST = opintl.h sysdep.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/os/bfd/opcodes/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/os/bfd/opcodes/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libopcodes.la: $(libopcodes_la_OBJECTS) $(libopcodes_la_DEPENDENCIES)
+ $(libopcodes_la_LINK) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dis-buf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/disassemble.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/i386-dis.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ppc-dis.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ppc-opc.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/bfd/opcodes/dis-buf.c b/backend/os/bfd/opcodes/dis-buf.c
similarity index 100%
rename from sysdeps/bfd/opcodes/dis-buf.c
rename to backend/os/bfd/opcodes/dis-buf.c
diff --git a/sysdeps/bfd/opcodes/disassemble.c b/backend/os/bfd/opcodes/disassemble.c
similarity index 100%
rename from sysdeps/bfd/opcodes/disassemble.c
rename to backend/os/bfd/opcodes/disassemble.c
diff --git a/sysdeps/bfd/opcodes/i386-dis.c b/backend/os/bfd/opcodes/i386-dis.c
similarity index 100%
rename from sysdeps/bfd/opcodes/i386-dis.c
rename to backend/os/bfd/opcodes/i386-dis.c
diff --git a/sysdeps/bfd/opcodes/opintl.h b/backend/os/bfd/opcodes/opintl.h
similarity index 100%
rename from sysdeps/bfd/opcodes/opintl.h
rename to backend/os/bfd/opcodes/opintl.h
diff --git a/sysdeps/bfd/opcodes/ppc-dis.c b/backend/os/bfd/opcodes/ppc-dis.c
similarity index 100%
rename from sysdeps/bfd/opcodes/ppc-dis.c
rename to backend/os/bfd/opcodes/ppc-dis.c
diff --git a/sysdeps/bfd/opcodes/ppc-opc.c b/backend/os/bfd/opcodes/ppc-opc.c
similarity index 100%
rename from sysdeps/bfd/opcodes/ppc-opc.c
rename to backend/os/bfd/opcodes/ppc-opc.c
diff --git a/sysdeps/bfd/opcodes/sysdep.h b/backend/os/bfd/opcodes/sysdep.h
similarity index 100%
rename from sysdeps/bfd/opcodes/sysdep.h
rename to backend/os/bfd/opcodes/sysdep.h
diff --git a/sysdeps/bfd/opncls.c b/backend/os/bfd/opncls.c
similarity index 100%
rename from sysdeps/bfd/opncls.c
rename to backend/os/bfd/opncls.c
diff --git a/sysdeps/bfd/pe-i386.c b/backend/os/bfd/pe-i386.c
similarity index 100%
rename from sysdeps/bfd/pe-i386.c
rename to backend/os/bfd/pe-i386.c
diff --git a/sysdeps/bfd/pef.c b/backend/os/bfd/pef.c
similarity index 100%
rename from sysdeps/bfd/pef.c
rename to backend/os/bfd/pef.c
diff --git a/sysdeps/bfd/pei-i386.c b/backend/os/bfd/pei-i386.c
similarity index 100%
rename from sysdeps/bfd/pei-i386.c
rename to backend/os/bfd/pei-i386.c
diff --git a/sysdeps/bfd/peicode.h b/backend/os/bfd/peicode.h
similarity index 100%
rename from sysdeps/bfd/peicode.h
rename to backend/os/bfd/peicode.h
diff --git a/sysdeps/bfd/peigen.c b/backend/os/bfd/peigen.c
similarity index 100%
rename from sysdeps/bfd/peigen.c
rename to backend/os/bfd/peigen.c
diff --git a/sysdeps/bfd/reloc.c b/backend/os/bfd/reloc.c
similarity index 100%
rename from sysdeps/bfd/reloc.c
rename to backend/os/bfd/reloc.c
diff --git a/sysdeps/bfd/rs6000-core.c b/backend/os/bfd/rs6000-core.c
similarity index 100%
rename from sysdeps/bfd/rs6000-core.c
rename to backend/os/bfd/rs6000-core.c
diff --git a/sysdeps/bfd/section.c b/backend/os/bfd/section.c
similarity index 100%
rename from sysdeps/bfd/section.c
rename to backend/os/bfd/section.c
diff --git a/sysdeps/bfd/simple.c b/backend/os/bfd/simple.c
similarity index 100%
rename from sysdeps/bfd/simple.c
rename to backend/os/bfd/simple.c
diff --git a/sysdeps/bfd/srec.c b/backend/os/bfd/srec.c
similarity index 100%
rename from sysdeps/bfd/srec.c
rename to backend/os/bfd/srec.c
diff --git a/sysdeps/bfd/stab-syms.c b/backend/os/bfd/stab-syms.c
similarity index 100%
rename from sysdeps/bfd/stab-syms.c
rename to backend/os/bfd/stab-syms.c
diff --git a/sysdeps/bfd/stabs.c b/backend/os/bfd/stabs.c
similarity index 100%
rename from sysdeps/bfd/stabs.c
rename to backend/os/bfd/stabs.c
diff --git a/sysdeps/bfd/syms.c b/backend/os/bfd/syms.c
similarity index 100%
rename from sysdeps/bfd/syms.c
rename to backend/os/bfd/syms.c
diff --git a/sysdeps/bfd/sysdep.h b/backend/os/bfd/sysdep.h
similarity index 100%
rename from sysdeps/bfd/sysdep.h
rename to backend/os/bfd/sysdep.h
diff --git a/sysdeps/bfd/targets.c b/backend/os/bfd/targets.c
similarity index 100%
rename from sysdeps/bfd/targets.c
rename to backend/os/bfd/targets.c
diff --git a/sysdeps/bfd/targmatch.h b/backend/os/bfd/targmatch.h
similarity index 100%
rename from sysdeps/bfd/targmatch.h
rename to backend/os/bfd/targmatch.h
diff --git a/sysdeps/bfd/tekhex.c b/backend/os/bfd/tekhex.c
similarity index 100%
rename from sysdeps/bfd/tekhex.c
rename to backend/os/bfd/tekhex.c
diff --git a/sysdeps/bfd/trad-core.c b/backend/os/bfd/trad-core.c
similarity index 100%
rename from sysdeps/bfd/trad-core.c
rename to backend/os/bfd/trad-core.c
diff --git a/sysdeps/bfd/version.h b/backend/os/bfd/version.h
similarity index 100%
rename from sysdeps/bfd/version.h
rename to backend/os/bfd/version.h
diff --git a/sysdeps/bfd/xsym.c b/backend/os/bfd/xsym.c
similarity index 100%
rename from sysdeps/bfd/xsym.c
rename to backend/os/bfd/xsym.c
diff --git a/sysdeps/server/bfdglue.c b/backend/os/bfdglue.c
similarity index 100%
rename from sysdeps/server/bfdglue.c
rename to backend/os/bfdglue.c
diff --git a/sysdeps/server/bfdglue.h b/backend/os/bfdglue.h
similarity index 100%
rename from sysdeps/server/bfdglue.h
rename to backend/os/bfdglue.h
diff --git a/backend/server/Makefile.am b/backend/server/Makefile.am
new file mode 100644
index 0000000..4674ddd
--- /dev/null
+++ b/backend/server/Makefile.am
@@ -0,0 +1,53 @@
+INCLUDES = @SERVER_DEPENDENCIES_CFLAGS@ @server_cflags@
+
+lib_LTLIBRARIES = libmonodebuggerserver.la
+
+EXTRA_libmonodebuggerserver_la_SOURCES = \
+ i386-arch.c \
+ i386-arch.h \
+ x86-arch.h \
+ x86_64-arch.h \
+ x86_64-arch.c \
+ x86-linux-ptrace.c \
+ x86-linux-ptrace.h \
+ x86-ptrace.c \
+ x86-ptrace.h
+
+if PLATFORM_POWERPC
+platform_sources =
+else
+if PLATFORM_X86_DARWIN
+platform_sources = \
+ x86-ptrace.c \
+ darwin-thread-db.c \
+ thread-db.h
+libmonodebuggerserver_la_LIBADD = \
+ @SERVER_DEPENDENCIES_LIBS@ \
+ ../os/libmonodebuggerbfdglue.la
+else
+platform_sources = \
+ x86-ptrace.c \
+ thread-db.c \
+ thread-db.h
+libmonodebuggerserver_la_LIBADD = \
+ @SERVER_DEPENDENCIES_LIBS@ -lthread_db \
+ ../os/libmonodebuggerbfdglue.la
+endif
+endif
+
+libmonodebuggerserver_la_SOURCES = \
+ server.h \
+ library.c \
+ $(platform_sources) \
+ breakpoints.c \
+ breakpoints.h \
+ mutex.c \
+ mutex.h \
+ libgtop-glue.c \
+ libgtop-glue.h \
+ linux-proc-service.h
+
+libmonodebuggerserver_la_LDFLAGS = \
+ -no-undefined -export-dynamic -shared
+
+CLEANFILES = lib*.a lib*.dll
diff --git a/backend/server/Makefile.in b/backend/server/Makefile.in
new file mode 100644
index 0000000..35a6879
--- /dev/null
+++ b/backend/server/Makefile.in
@@ -0,0 +1,579 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = backend/server
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at libmonodebuggerserver_la_DEPENDENCIES = ../os/libmonodebuggerbfdglue.la
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at libmonodebuggerserver_la_DEPENDENCIES = ../os/libmonodebuggerbfdglue.la
+am__libmonodebuggerserver_la_SOURCES_DIST = server.h library.c \
+ x86-ptrace.c thread-db.c thread-db.h darwin-thread-db.c \
+ breakpoints.c breakpoints.h mutex.c mutex.h libgtop-glue.c \
+ libgtop-glue.h linux-proc-service.h
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at am__objects_1 = x86-ptrace.lo \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ thread-db.lo
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at am__objects_1 = x86-ptrace.lo \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ darwin-thread-db.lo
+am_libmonodebuggerserver_la_OBJECTS = library.lo $(am__objects_1) \
+ breakpoints.lo mutex.lo libgtop-glue.lo
+libmonodebuggerserver_la_OBJECTS = \
+ $(am_libmonodebuggerserver_la_OBJECTS)
+libmonodebuggerserver_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libmonodebuggerserver_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmonodebuggerserver_la_SOURCES) \
+ $(EXTRA_libmonodebuggerserver_la_SOURCES)
+DIST_SOURCES = $(am__libmonodebuggerserver_la_SOURCES_DIST) \
+ $(EXTRA_libmonodebuggerserver_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = @SERVER_DEPENDENCIES_CFLAGS@ @server_cflags@
+lib_LTLIBRARIES = libmonodebuggerserver.la
+EXTRA_libmonodebuggerserver_la_SOURCES = \
+ i386-arch.c \
+ i386-arch.h \
+ x86-arch.h \
+ x86_64-arch.h \
+ x86_64-arch.c \
+ x86-linux-ptrace.c \
+ x86-linux-ptrace.h \
+ x86-ptrace.c \
+ x86-ptrace.h
+
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at platform_sources = \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ x86-ptrace.c \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ thread-db.c \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ thread-db.h
+
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at platform_sources = \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ x86-ptrace.c \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ darwin-thread-db.c \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ thread-db.h
+
+ at PLATFORM_POWERPC_TRUE@platform_sources =
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at libmonodebuggerserver_la_LIBADD = \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ @SERVER_DEPENDENCIES_LIBS@ -lthread_db \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ ../os/libmonodebuggerbfdglue.la
+
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at libmonodebuggerserver_la_LIBADD = \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ @SERVER_DEPENDENCIES_LIBS@ \
+ at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ ../os/libmonodebuggerbfdglue.la
+
+libmonodebuggerserver_la_SOURCES = \
+ server.h \
+ library.c \
+ $(platform_sources) \
+ breakpoints.c \
+ breakpoints.h \
+ mutex.c \
+ mutex.h \
+ libgtop-glue.c \
+ libgtop-glue.h \
+ linux-proc-service.h
+
+libmonodebuggerserver_la_LDFLAGS = \
+ -no-undefined -export-dynamic -shared
+
+CLEANFILES = lib*.a lib*.dll
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu backend/server/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu backend/server/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmonodebuggerserver.la: $(libmonodebuggerserver_la_OBJECTS) $(libmonodebuggerserver_la_DEPENDENCIES)
+ $(libmonodebuggerserver_la_LINK) -rpath $(libdir) $(libmonodebuggerserver_la_OBJECTS) $(libmonodebuggerserver_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/breakpoints.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/darwin-thread-db.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/i386-arch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtop-glue.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/library.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mutex.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/thread-db.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/x86-linux-ptrace.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/x86-ptrace.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/x86_64-arch.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/sysdeps/server/breakpoints.c b/backend/server/breakpoints.c
similarity index 100%
rename from sysdeps/server/breakpoints.c
rename to backend/server/breakpoints.c
diff --git a/sysdeps/server/breakpoints.h b/backend/server/breakpoints.h
similarity index 100%
rename from sysdeps/server/breakpoints.h
rename to backend/server/breakpoints.h
diff --git a/sysdeps/server/darwin-thread-db.c b/backend/server/darwin-thread-db.c
similarity index 100%
rename from sysdeps/server/darwin-thread-db.c
rename to backend/server/darwin-thread-db.c
diff --git a/sysdeps/server/i386-arch.c b/backend/server/i386-arch.c
similarity index 100%
rename from sysdeps/server/i386-arch.c
rename to backend/server/i386-arch.c
diff --git a/sysdeps/server/i386-arch.h b/backend/server/i386-arch.h
similarity index 100%
rename from sysdeps/server/i386-arch.h
rename to backend/server/i386-arch.h
diff --git a/sysdeps/server/libgtop-glue.c b/backend/server/libgtop-glue.c
similarity index 100%
rename from sysdeps/server/libgtop-glue.c
rename to backend/server/libgtop-glue.c
diff --git a/sysdeps/server/libgtop-glue.h b/backend/server/libgtop-glue.h
similarity index 100%
rename from sysdeps/server/libgtop-glue.h
rename to backend/server/libgtop-glue.h
diff --git a/backend/server/library.c b/backend/server/library.c
new file mode 100644
index 0000000..ef75b97
--- /dev/null
+++ b/backend/server/library.c
@@ -0,0 +1,554 @@
+#include <config.h>
+#include <server.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if defined(__linux__) || defined(__FreeBSD__)
+#include <sys/poll.h>
+#include <sys/select.h>
+#endif
+#include <errno.h>
+#include <stdio.h>
+
+#if defined(__POWERPC__)
+extern InferiorVTable powerpc_darwin_inferior;
+InferiorVTable *global_vtable = &powerpc_darwin_inferior;
+#elif defined(WIN32)
+extern InferiorVTable i386_windows_inferior;
+static InferiorVTable *global_vtable = &i386_windows_inferior;
+#else
+extern InferiorVTable i386_ptrace_inferior;
+static InferiorVTable *global_vtable = &i386_ptrace_inferior;
+#endif
+
+ServerHandle *
+mono_debugger_server_create_inferior (BreakpointManager *breakpoint_manager)
+{
+ return global_vtable->create_inferior (breakpoint_manager);
+}
+
+guint32
+mono_debugger_server_get_current_pid (void)
+{
+ return global_vtable->get_current_pid ();
+}
+
+guint64
+mono_debugger_server_get_current_thread (void)
+{
+ return global_vtable->get_current_thread ();
+}
+
+ServerCapabilities
+mono_debugger_server_get_capabilities (void)
+{
+ return global_vtable->get_capabilities ();
+}
+
+ServerType
+mono_debugger_server_get_server_type (void)
+{
+ return global_vtable->get_server_type ();
+}
+
+void
+mono_debugger_server_io_thread_main (IOThreadData *io_data, ChildOutputFunc func)
+{
+ (global_vtable->io_thread_main) (io_data, func);
+}
+
+ServerCommandError
+mono_debugger_server_spawn (ServerHandle *handle, const gchar *working_directory,
+ const gchar **argv, const gchar **envp, gboolean redirect_fds,
+ gint *child_pid, IOThreadData **io_data, gchar **error)
+{
+ if (!global_vtable->spawn)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->spawn) (handle, working_directory, argv, envp, redirect_fds,
+ child_pid, io_data, error);
+}
+
+ServerCommandError
+mono_debugger_server_initialize_process (ServerHandle *handle)
+{
+ if (!global_vtable->initialize_process)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->initialize_process) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_initialize_thread (ServerHandle *handle, guint32 pid, gboolean wait)
+{
+ if (!global_vtable->initialize_thread)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->initialize_thread) (handle, pid, wait);
+}
+
+ServerCommandError
+mono_debugger_server_attach (ServerHandle *handle, guint32 pid)
+{
+ if (!global_vtable->attach)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->attach) (handle, pid);
+}
+
+void
+mono_debugger_server_finalize (ServerHandle *handle)
+{
+ (* global_vtable->finalize) (handle);
+}
+
+void
+mono_debugger_server_global_init (void)
+{
+ (* global_vtable->global_init) ();
+}
+
+guint32
+mono_debugger_server_global_wait (guint32 *status)
+{
+ return (* global_vtable->global_wait) (status);
+}
+
+ServerStatusMessageType
+mono_debugger_server_dispatch_event (ServerHandle *handle, guint32 status, guint64 *arg,
+ guint64 *data1, guint64 *data2, guint32 *opt_data_size,
+ gpointer *opt_data)
+{
+ return (*global_vtable->dispatch_event) (
+ handle, status, arg, data1, data2, opt_data_size, opt_data);
+}
+
+ServerStatusMessageType
+mono_debugger_server_dispatch_simple (guint32 status, guint32 *arg)
+{
+ return (*global_vtable->dispatch_simple) (status, arg);
+}
+
+ServerCommandError
+mono_debugger_server_get_target_info (guint32 *target_int_size, guint32 *target_long_size,
+ guint32 *target_address_size, guint32 *is_bigendian)
+{
+ if (!global_vtable->get_target_info)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_target_info) (
+ target_int_size, target_long_size, target_address_size, is_bigendian);
+}
+
+ServerCommandError
+mono_debugger_server_get_frame (ServerHandle *handle, StackFrame *frame)
+{
+ if (!global_vtable->get_frame)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_frame) (handle, frame);
+}
+
+ServerCommandError
+mono_debugger_server_current_insn_is_bpt (ServerHandle *handle, guint32 *is_breakpoint)
+{
+ if (!global_vtable->current_insn_is_bpt)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->current_insn_is_bpt) (handle, is_breakpoint);
+}
+
+ServerCommandError
+mono_debugger_server_step (ServerHandle *handle)
+{
+ if (!global_vtable->step)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->step) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_continue (ServerHandle *handle)
+{
+ if (!global_vtable->run)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->run) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_resume (ServerHandle *handle)
+{
+ if (!global_vtable->resume)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->resume) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_detach (ServerHandle *handle)
+{
+ if (!global_vtable->detach)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->detach) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_peek_word (ServerHandle *handle, guint64 start, guint64 *word)
+{
+ if (!global_vtable->peek_word)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->peek_word) (handle, start, word);
+}
+
+ServerCommandError
+mono_debugger_server_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer data)
+{
+ if (!global_vtable->read_memory)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->read_memory) (handle, start, size, data);
+}
+
+ServerCommandError
+mono_debugger_server_write_memory (ServerHandle *handle, guint64 start, guint32 size, gconstpointer data)
+{
+ if (!global_vtable->write_memory)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->write_memory) (handle, start, size, data);
+}
+
+ServerCommandError
+mono_debugger_server_call_method (ServerHandle *handle, guint64 method_address,
+ guint64 method_argument1, guint64 method_argument2,
+ guint64 callback_argument)
+{
+ if (!global_vtable->call_method)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->call_method) (
+ handle, method_address, method_argument1, method_argument2,
+ callback_argument);
+}
+
+ServerCommandError
+mono_debugger_server_call_method_1 (ServerHandle *handle, guint64 method_address,
+ guint64 method_argument, guint64 data_argument,
+ guint64 data_argument2, const gchar *string_argument,
+ guint64 callback_argument)
+{
+ if (!global_vtable->call_method_1)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->call_method_1) (
+ handle, method_address, method_argument, data_argument,
+ data_argument2, string_argument, callback_argument);
+}
+
+ServerCommandError
+mono_debugger_server_call_method_2 (ServerHandle *handle, guint64 method_address,
+ guint32 data_size, gconstpointer data_buffer,
+ guint64 callback_argument)
+{
+ if (!global_vtable->call_method_2)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->call_method_2) (
+ handle, method_address, data_size, data_buffer, callback_argument);
+}
+
+ServerCommandError
+mono_debugger_server_call_method_3 (ServerHandle *handle, guint64 method_address,
+ guint64 method_argument, guint64 address_argument,
+ guint32 blob_size, gconstpointer blob_data,
+ guint64 callback_argument)
+{
+ if (!global_vtable->call_method_2)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->call_method_3) (
+ handle, method_address, method_argument, address_argument, blob_size,
+ blob_data, callback_argument);
+}
+
+ServerCommandError
+mono_debugger_server_call_method_invoke (ServerHandle *handle, guint64 invoke_method,
+ guint64 method_argument, guint32 num_params,
+ guint32 blob_size, guint64 *param_data,
+ gint32 *offset_data, gconstpointer blob_data,
+ guint64 callback_argument, gboolean debug)
+{
+ if (!global_vtable->call_method_invoke)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->call_method_invoke) (
+ handle, invoke_method, method_argument, num_params, blob_size,
+ param_data, offset_data, blob_data, callback_argument, debug);
+}
+
+ServerCommandError
+mono_debugger_server_execute_instruction (ServerHandle *handle, const guint8 *instruction,
+ guint32 insn_size, gboolean update_ip)
+{
+ if (!global_vtable->execute_instruction)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->execute_instruction) (
+ handle, instruction, insn_size, update_ip);
+}
+
+ServerCommandError
+mono_debugger_server_mark_rti_frame (ServerHandle *handle)
+{
+ if (!global_vtable->mark_rti_frame)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->mark_rti_frame) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_abort_invoke (ServerHandle *handle, guint64 rti_id)
+{
+ if (!global_vtable->abort_invoke)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->abort_invoke) (handle, rti_id);
+}
+
+ServerCommandError
+mono_debugger_server_insert_breakpoint (ServerHandle *handle, guint64 address, guint32 *breakpoint)
+{
+ if (!global_vtable->insert_breakpoint)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->insert_breakpoint) (handle, address, breakpoint);
+}
+
+ServerCommandError
+mono_debugger_server_insert_hw_breakpoint (ServerHandle *handle, guint32 type, guint32 *idx,
+ guint64 address, guint32 *breakpoint)
+{
+ if (!global_vtable->insert_hw_breakpoint)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->insert_hw_breakpoint) (
+ handle, type, idx, address, breakpoint);
+}
+
+ServerCommandError
+mono_debugger_server_remove_breakpoint (ServerHandle *handle, guint32 breakpoint)
+{
+ if (!global_vtable->remove_breakpoint)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->remove_breakpoint) (handle, breakpoint);
+}
+
+ServerCommandError
+mono_debugger_server_enable_breakpoint (ServerHandle *handle, guint32 breakpoint)
+{
+ if (!global_vtable->enable_breakpoint)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->enable_breakpoint) (handle, breakpoint);
+}
+
+ServerCommandError
+mono_debugger_server_disable_breakpoint (ServerHandle *handle, guint32 breakpoint)
+{
+ if (!global_vtable->disable_breakpoint)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->disable_breakpoint) (handle, breakpoint);
+}
+
+ServerCommandError
+mono_debugger_server_get_registers (ServerHandle *handle, guint64 *values)
+{
+ if (!global_vtable->get_registers)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_registers) (handle, values);
+}
+
+ServerCommandError
+mono_debugger_server_set_registers (ServerHandle *handle, guint64 *values)
+{
+ if (!global_vtable->set_registers)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->set_registers) (handle, values);
+}
+
+ServerCommandError
+mono_debugger_server_stop (ServerHandle *handle)
+{
+ if (!global_vtable->stop)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->stop) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_stop_and_wait (ServerHandle *handle, guint32 *status)
+{
+ if (!global_vtable->stop_and_wait)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->stop_and_wait) (handle, status);
+}
+
+ServerCommandError
+mono_debugger_server_set_signal (ServerHandle *handle, guint32 sig, guint32 send_it)
+{
+ if (!global_vtable->set_signal)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->set_signal) (handle, sig, send_it);
+}
+
+ServerCommandError
+mono_debugger_server_get_pending_signal (ServerHandle *handle, guint32 *signal)
+{
+ if (!global_vtable->get_pending_signal)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_pending_signal) (handle, signal);
+}
+
+ServerCommandError
+mono_debugger_server_kill (ServerHandle *handle)
+{
+ return (* global_vtable->kill) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_get_signal_info (ServerHandle *handle, SignalInfo **sinfo)
+{
+ *sinfo = NULL;
+
+ if (!global_vtable->get_signal_info)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_signal_info) (handle, sinfo);
+
+}
+
+void
+mono_debugger_server_set_runtime_info (ServerHandle *handle, MonoRuntimeInfo *mono_runtime)
+{
+ if (global_vtable->set_runtime_info)
+ (* global_vtable->set_runtime_info) (handle, mono_runtime);
+}
+
+ServerCommandError
+mono_debugger_server_get_threads (ServerHandle *handle, guint32 *count, guint32 **threads)
+{
+ if (!global_vtable->get_threads)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_threads) (handle, count, threads);
+}
+
+ServerCommandError
+mono_debugger_server_get_application (ServerHandle *handle, gchar **exe_file, gchar **cwd,
+ guint32 *nargs, gchar ***cmdline_args)
+{
+ if (!global_vtable->get_application)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_application) (handle, exe_file, cwd, nargs, cmdline_args);
+}
+
+ServerCommandError
+mono_debugger_server_detach_after_fork (ServerHandle *handle)
+{
+ if (!global_vtable->detach_after_fork)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->detach_after_fork) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_push_registers (ServerHandle *handle, guint64 *new_rsp)
+{
+ if (!global_vtable->push_registers)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->push_registers) (handle, new_rsp);
+}
+
+ServerCommandError
+mono_debugger_server_pop_registers (ServerHandle *handle)
+{
+ if (!global_vtable->pop_registers)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->pop_registers) (handle);
+}
+
+ServerCommandError
+mono_debugger_server_get_callback_frame (ServerHandle *handle, guint64 stack_pointer,
+ gboolean exact_match, CallbackInfo *info)
+{
+ if (!global_vtable->get_callback_frame)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->get_callback_frame) (
+ handle, stack_pointer, exact_match, info);
+}
+
+ServerCommandError
+mono_debugger_server_restart_notification (ServerHandle *handle)
+{
+ if (!global_vtable->restart_notification)
+ return COMMAND_ERROR_NOT_IMPLEMENTED;
+
+ return (* global_vtable->restart_notification) (handle);
+}
+
+void
+mono_debugger_server_get_registers_from_core_file (guint64 *values, const guint8 *buffer)
+{
+ (* global_vtable->get_registers_from_core_file) (values, buffer);
+}
+
+
+void
+mono_debugger_server_static_init (void)
+{
+ (* global_vtable->static_init) ();
+}
+
+int
+mono_debugger_server_get_pending_sigint (void)
+{
+ return (* global_vtable->get_pending_sigint) ();
+}
+
+void
+mono_debugger_server_sem_init (void)
+{
+ (* global_vtable->sem_init) ();
+}
+
+void
+mono_debugger_server_sem_wait (void)
+{
+ (* global_vtable->sem_wait) ();
+}
+
+void
+mono_debugger_server_sem_post (void)
+{
+ (* global_vtable->sem_post) ();
+}
+
+int
+mono_debugger_server_sem_get_value (void)
+{
+ return (* global_vtable->sem_get_value) ();
+}
diff --git a/sysdeps/server/linux-proc-service.h b/backend/server/linux-proc-service.h
similarity index 100%
rename from sysdeps/server/linux-proc-service.h
rename to backend/server/linux-proc-service.h
diff --git a/backend/server/mutex.c b/backend/server/mutex.c
new file mode 100644
index 0000000..2d252e6
--- /dev/null
+++ b/backend/server/mutex.c
@@ -0,0 +1,65 @@
+#include <server.h>
+#include <mutex.h>
+
+GMutex *
+mono_debugger_mutex_new (void)
+{
+ return g_mutex_new ();
+}
+
+void
+mono_debugger_mutex_free (GMutex *mutex)
+{
+ g_mutex_free (mutex);
+}
+
+void
+mono_debugger_mutex_lock (GMutex *mutex)
+{
+ g_mutex_lock (mutex);
+}
+
+void
+mono_debugger_mutex_unlock (GMutex *mutex)
+{
+ g_mutex_unlock (mutex);
+}
+
+gboolean
+mono_debugger_mutex_trylock (GMutex *mutex)
+{
+ return g_mutex_trylock (mutex);
+}
+
+GCond *
+mono_debugger_cond_new (void)
+{
+ return g_cond_new ();
+}
+
+void
+mono_debugger_cond_free (GCond *cond)
+{
+ g_cond_free (cond);
+}
+
+void
+mono_debugger_cond_wait (GMutex *mutex, GCond *cond)
+{
+ g_cond_wait (cond, mutex);
+}
+
+gboolean
+mono_debugger_cond_timed_wait (GMutex *mutex, GCond *cond, int milliseconds)
+{
+ GTimeVal time_val;
+ g_get_current_time (&time_val);
+ g_time_val_add (&time_val, milliseconds);
+ return g_cond_timed_wait (cond, mutex, &time_val);
+}
+
+void
+mono_debugger_cond_broadcast (GCond *cond)
+{
+ g_cond_broadcast (cond);
+}
diff --git a/backend/server/mutex.h b/backend/server/mutex.h
new file mode 100644
index 0000000..8b3195d
--- /dev/null
+++ b/backend/server/mutex.h
@@ -0,0 +1,38 @@
+#ifndef __MONO_DEBUGGER_MUTEX_H__
+#define __MONO_DEBUGGER_MUTEX_H__
+
+#include <glib.h>
+#include <glib/gthread.h>
+
+G_BEGIN_DECLS
+
+GMutex *
+mono_debugger_mutex_new (void);
+
+void
+mono_debugger_mutex_free (GMutex *mutex);
+
+void
+mono_debugger_mutex_lock (GMutex *mutex);
+
+void
+mono_debugger_mutex_unlock (GMutex *mutex);
+
+gboolean
+mono_debugger_mutex_trylock (GMutex *mutex);
+
+GCond *
+mono_debugger_cond_new (void);
+
+void
+mono_debugger_cond_free (GCond *cond);
+
+void
+mono_debugger_cond_wait (GMutex *mutex, GCond *cond);
+
+void
+mono_debugger_cond_broadcast (GCond *cond);
+
+G_END_DECLS
+
+#endif
diff --git a/backend/server/server.h b/backend/server/server.h
new file mode 100644
index 0000000..c987b3f
--- /dev/null
+++ b/backend/server/server.h
@@ -0,0 +1,753 @@
+#ifndef __MONO_DEBUGGER_SERVER_H__
+#define __MONO_DEBUGGER_SERVER_H__
+
+#include <breakpoints.h>
+#include <signal.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#ifdef __GNUC__
+#define MONO_ZERO_LEN_ARRAY 0
+#else
+#define MONO_ZERO_LEN_ARRAY 1
+#endif
+
+#define MONO_DEBUGGER_REMOTE_VERSION 1
+#define MONO_DEBUGGER_REMOTE_MAGIC 0x36885fe4
+
+/*
+ * Keep in sync with TargetExceptionType in classes/TargetException.cs.
+ */
+typedef enum {
+ COMMAND_ERROR_NONE = 0,
+ COMMAND_ERROR_UNKNOWN_ERROR,
+ COMMAND_ERROR_INTERNAL_ERROR,
+ COMMAND_ERROR_NO_TARGET,
+ COMMAND_ERROR_ALREADY_HAVE_TARGET,
+ COMMAND_ERROR_CANNOT_START_TARGET,
+ COMMAND_ERROR_NOT_STOPPED,
+ COMMAND_ERROR_ALREADY_STOPPED,
+ COMMAND_ERROR_RECURSIVE_CALL,
+ COMMAND_ERROR_NO_SUCH_BREAKPOINT,
+ COMMAND_ERROR_NO_SUCH_REGISTER,
+ COMMAND_ERROR_DR_OCCUPIED,
+ COMMAND_ERROR_MEMORY_ACCESS,
+ COMMAND_ERROR_NOT_IMPLEMENTED,
+ COMMAND_ERROR_IO_ERROR,
+ COMMAND_ERROR_NO_CALLBACK_FRAME,
+ COMMAND_ERROR_PERMISSION_DENIED
+} ServerCommandError;
+
+typedef enum {
+ MESSAGE_NONE,
+ MESSAGE_UNKNOWN_ERROR = 1,
+ MESSAGE_CHILD_EXITED = 2,
+ MESSAGE_CHILD_STOPPED,
+ MESSAGE_CHILD_SIGNALED,
+ MESSAGE_CHILD_CALLBACK,
+ MESSAGE_CHILD_CALLBACK_COMPLETED,
+ MESSAGE_CHILD_HIT_BREAKPOINT,
+ MESSAGE_CHILD_MEMORY_CHANGED,
+ MESSAGE_CHILD_CREATED_THREAD,
+ MESSAGE_CHILD_FORKED,
+ MESSAGE_CHILD_EXECD,
+ MESSAGE_CHILD_CALLED_EXIT,
+ MESSAGE_CHILD_NOTIFICATION,
+ MESSAGE_CHILD_INTERRUPTED,
+ MESSAGE_RUNTIME_INVOKE_DONE,
+ MESSAGE_INTERNAL_ERROR
+} ServerStatusMessageType;
+
+typedef struct {
+ ServerStatusMessageType type;
+ guint32 arg;
+} ServerStatusMessage;
+
+typedef struct {
+ guint64 address;
+ guint64 stack_pointer;
+ guint64 frame_address;
+} StackFrame;
+
+typedef struct {
+ guint64 callback_argument;
+ guint64 call_address;
+ guint64 stack_pointer;
+ guint64 is_rti_frame : 1;
+ guint64 is_exact_match : 1;
+ guint64 saved_registers [MONO_ZERO_LEN_ARRAY];
+} CallbackInfo;
+
+#define EXECUTABLE_CODE_CHUNK_SIZE 16
+
+typedef struct
+{
+ guint32 address_size;
+ guint64 notification_address;
+ guint64 executable_code_buffer;
+ guint32 executable_code_buffer_size;
+ guint32 executable_code_chunk_size;
+ guint32 executable_code_total_chunks;
+ guint64 breakpoint_info_area;
+ guint64 breakpoint_table;
+ guint32 breakpoint_table_size;
+
+ /* Private */
+ guint8 *breakpoint_table_bitfield;
+ guint8 *executable_code_bitfield;
+ guint32 executable_code_last_slot;
+} MonoRuntimeInfo;
+
+typedef enum {
+ SERVER_CAPABILITIES_NONE = 0,
+ SERVER_CAPABILITIES_THREAD_EVENTS = 1,
+ SERVER_CAPABILITIES_CAN_DETACH_ANY = 2
+} ServerCapabilities;
+
+typedef enum {
+ SERVER_TYPE_UNKNOWN = 0,
+ SERVER_TYPE_LINUX_PTRACE = 1,
+ SERVER_TYPE_DARWIN = 2,
+ SERVER_TYPE_WIN32 = 3
+} ServerType;
+
+/* This is an opaque data structure which the backend may use to store stuff. */
+typedef struct InferiorVTable InferiorVTable;
+typedef struct InferiorHandle InferiorHandle;
+typedef struct ServerHandle ServerHandle;
+typedef struct ArchInfo ArchInfo;
+
+typedef struct IOThreadData IOThreadData;
+
+/* C# delegates. */
+typedef void (*ChildOutputFunc) (gboolean is_stderr, const char *output);
+
+typedef struct {
+ int sigkill;
+ int sigstop;
+ int sigint;
+ int sigchld;
+ int sigfpe;
+ int sigquit;
+ int sigabrt;
+ int sigsegv;
+ int sigill;
+ int sigbus;
+ int sigwinch;
+ int kernel_sigrtmin;
+ int mono_thread_abort;
+} SignalInfo;
+
+/*
+ * Server functions.
+ *
+ * When porting the debugger to another architecture, you need to implement all functions
+ * in this vtable.
+ *
+ * It is a requirement that all functions always return immediately without blocking.
+ * If the requested operation cannot be performed (for instance because the target is currently
+ * running, don't wait for it but return an error condition!).
+ */
+
+struct ServerHandle {
+ ArchInfo *arch;
+ InferiorHandle *inferior;
+ MonoRuntimeInfo *mono_runtime;
+ BreakpointManager *bpm;
+};
+
+struct InferiorVTable {
+
+ void (* static_init) (void);
+
+ void (* global_init) (void);
+
+ ServerType (* get_server_type) (void);
+
+ ServerCapabilities (* get_capabilities) (void);
+
+ ServerHandle * (* create_inferior) (BreakpointManager *bpm);
+
+ ServerCommandError (* initialize_process) (ServerHandle *handle);
+
+ ServerCommandError (* initialize_thread) (ServerHandle *handle,
+ guint32 pid,
+ gboolean wait);
+
+ void (* set_runtime_info) (ServerHandle *handle,
+ MonoRuntimeInfo *mono_runtime_info);
+
+ void (* io_thread_main) (IOThreadData *io_data,
+ ChildOutputFunc func);
+
+ ServerCommandError (* spawn) (ServerHandle *handle,
+ const gchar *working_directory,
+ const gchar **argv,
+ const gchar **envp,
+ gboolean redirect_fds,
+ gint *child_pid,
+ IOThreadData **io_data,
+ gchar **error);
+
+ ServerCommandError (* attach) (ServerHandle *handle,
+ guint32 pid);
+
+ ServerCommandError (* detach) (ServerHandle *handle);
+
+ void (* finalize) (ServerHandle *handle);
+
+ guint32 (* global_wait) (guint32 *status_ret);
+
+ ServerCommandError (* stop_and_wait) (ServerHandle *handle,
+ guint32 *status);
+
+ ServerStatusMessageType (* dispatch_event) (ServerHandle *handle,
+ guint32 status,
+ guint64 *arg,
+ guint64 *data1,
+ guint64 *data2,
+ guint32 *opt_data_size,
+ gpointer *opt_data);
+
+ ServerStatusMessageType (* dispatch_simple) (guint32 status,
+ guint32 *arg);
+
+ /* Get sizeof (int), sizeof (long) and sizeof (void *) from the target. */
+ ServerCommandError (* get_target_info) (guint32 *target_int_size,
+ guint32 *target_long_size,
+ guint32 *target_address_size,
+ guint32 *is_bigendian);
+
+ /*
+ * Continue the target.
+ * This operation must start the target and then return immediately
+ * (without waiting for the target to stop).
+ */
+ ServerCommandError (* run) (ServerHandle *handle);
+
+ /*
+ * Single-step one machine instruction.
+ * This operation must start the target and then return immediately
+ * (without waiting for the target to stop).
+ */
+ ServerCommandError (* step) (ServerHandle *handle);
+
+ ServerCommandError (* resume) (ServerHandle *handle);
+
+ /*
+ * Get the current program counter.
+ * Return COMMAND_ERROR_NOT_STOPPED if the target is currently running.
+ * This is a time-critical function, it must return immediately without blocking.
+ */
+ ServerCommandError (* get_frame) (ServerHandle *handle,
+ StackFrame *frame);
+
+ /*
+ * Checks whether the current instruction is a breakpoint.
+ */
+ ServerCommandError (* current_insn_is_bpt) (ServerHandle *handle,
+ guint32 *is_breakpoint);
+
+ ServerCommandError (* peek_word) (ServerHandle *handle,
+ guint64 start,
+ guint64 *word);
+
+ /*
+ * Read `size' bytes from the target's address space starting at `start'.
+ * Writes the result into `buffer' (which has been allocated by the caller).
+ */
+ ServerCommandError (* read_memory) (ServerHandle *handle,
+ guint64 start,
+ guint32 size,
+ gpointer buffer);
+
+ /*
+ * Write `size' bytes from `buffer' to the target's address space starting at `start'.
+ */
+ ServerCommandError (* write_memory) (ServerHandle *handle,
+ guint64 start,
+ guint32 size,
+ gconstpointer data);
+
+ /*
+ * Call `guint64 (*func) (guint64)' function at address `method' in the target address
+ * space, pass it argument `method_argument', send a MESSAGE_CHILD_CALLBACK with the
+ * `callback_argument' and the function's return value when the function returns.
+ * This function must return immediately without waiting for the target !
+ */
+ ServerCommandError (* call_method) (ServerHandle *handle,
+ guint64 method,
+ guint64 method_argument1,
+ guint64 method_argument2,
+ guint64 callback_argument);
+
+ /*
+ * Call `guint64 (*func) (guint64, const gchar *)' function at address `method' in the
+ * target address space, pass it arguments `method_argument' and `string_argument' , send
+ * a MESSAGE_CHILD_CALLBACK with the `callback_argument' and the function's return value
+ * when the function returns.
+ * This function must return immediately without waiting for the target !
+ */
+ ServerCommandError (* call_method_1) (ServerHandle *handle,
+ guint64 method,
+ guint64 method_argument,
+ guint64 data_argument,
+ guint64 data_argument2,
+ const gchar *string_argument,
+ guint64 callback_argument);
+
+ ServerCommandError (* call_method_2) (ServerHandle *handle,
+ guint64 method,
+ guint32 data_size,
+ gconstpointer data_buffer,
+ guint64 callback_argument);
+
+ ServerCommandError (* call_method_3) (ServerHandle *handle,
+ guint64 method_address,
+ guint64 method_argument,
+ guint64 address_argument,
+ guint32 blob_size,
+ gconstpointer blob_data,
+ guint64 callback_argument);
+
+ ServerCommandError (* call_method_invoke) (ServerHandle *handle,
+ guint64 invoke_method,
+ guint64 method_argument,
+ guint32 num_params,
+ guint32 glob_size,
+ guint64 *param_data,
+ gint32 *offset_data,
+ gconstpointer blob_data,
+ guint64 callback_argument,
+ gboolean debug);
+
+ ServerCommandError (* execute_instruction) (ServerHandle *handle,
+ const guint8 *instruction,
+ guint32 size,
+ gboolean update_ip);
+
+ ServerCommandError (* mark_rti_frame) (ServerHandle *handle);
+
+ ServerCommandError (* abort_invoke) (ServerHandle *handle,
+ guint64 rti_id);
+
+ /*
+ * Insert a breakpoint at address `address' in the target's address space.
+ * Returns a breakpoint handle in `bhandle' which can be passed to `remove_breakpoint'
+ * to remove the breakpoint.
+ */
+ ServerCommandError (* insert_breakpoint) (ServerHandle *handle,
+ guint64 address,
+ guint32 *bhandle);
+
+ /*
+ * Insert a hardware breakpoint at address `address' in the target's address space.
+ * Returns a breakpoint handle in `bhandle' which can be passed to `remove_breakpoint'
+ * to remove the breakpoint.
+ */
+ ServerCommandError (* insert_hw_breakpoint)(ServerHandle *handle,
+ guint32 type,
+ guint32 *idx,
+ guint64 address,
+ guint32 *bhandle);
+
+ /*
+ * Remove breakpoint `bhandle'.
+ */
+ ServerCommandError (* remove_breakpoint) (ServerHandle *handle,
+ guint32 bhandle);
+
+ /*
+ * Enables breakpoint `bhandle'.
+ */
+ ServerCommandError (* enable_breakpoint) (ServerHandle *handle,
+ guint32 bhandle);
+
+ /*
+ * Disables breakpoint `bhandle'.
+ */
+ ServerCommandError (* disable_breakpoint) (ServerHandle *handle,
+ guint32 bhandle);
+
+ /*
+ * Get all breakpoints. Writes number of breakpoints into `count' and returns a g_new0()
+ * allocated list of guint32's in `breakpoints'. The caller is responsible for freeing this
+ * data structure.
+ */
+ ServerCommandError (* get_breakpoints) (ServerHandle *handle,
+ guint32 *count,
+ guint32 **breakpoints);
+
+ /*
+ * Get processor registers.
+ *
+ */
+ ServerCommandError (* get_registers) (ServerHandle *handle,
+ guint64 *values);
+
+ /*
+ * Set processor registers.
+ *
+ */
+ ServerCommandError (* set_registers) (ServerHandle *handle,
+ guint64 *values);
+
+ /*
+ * Stop the target.
+ */
+ ServerCommandError (* stop) (ServerHandle *handle);
+
+ /*
+ * Send signal `sig' to the target the next time it is continued.
+ */
+ ServerCommandError (* set_signal) (ServerHandle *handle,
+ guint32 sig,
+ guint32 send_it);
+
+ ServerCommandError (* get_pending_signal) (ServerHandle *handle,
+ guint32 *signal);
+
+ /*
+ * Kill the target.
+ */
+ ServerCommandError (* kill) (ServerHandle *handle);
+
+ ServerCommandError (* get_signal_info) (ServerHandle *handle,
+ SignalInfo **sinfo);
+
+ ServerCommandError (* get_threads) (ServerHandle *handle,
+ guint32 *count,
+ guint32 **threads);
+
+ ServerCommandError (* get_application) (ServerHandle *handle,
+ gchar **exe_file,
+ gchar **cwd,
+ guint32 *nargs,
+ gchar ***cmdline_args);
+
+ ServerCommandError (* detach_after_fork) (ServerHandle *handle);
+
+ ServerCommandError (* push_registers) (ServerHandle *handle,
+ guint64 *new_rsp);
+
+ ServerCommandError (* pop_registers) (ServerHandle *handle);
+
+ ServerCommandError (* get_callback_frame) (ServerHandle *handle,
+ guint64 stack_pointer,
+ gboolean exact_match,
+ CallbackInfo *info);
+
+ ServerCommandError (* restart_notification) (ServerHandle *handle);
+
+ void (* get_registers_from_core_file) (guint64 *values,
+ const guint8 *buffer);
+
+ guint32 (*get_current_pid) (void);
+
+ guint64 (*get_current_thread) (void);
+
+ void (*sem_init) (void);
+
+ void (*sem_wait) (void);
+
+ void (*sem_post) (void);
+
+ int (*sem_get_value) (void);
+
+ int (*get_pending_sigint) (void);
+};
+
+/*
+ * Library functions.
+ *
+ * These functions just call the corresponding function in the ServerHandle's vtable.
+ * They're just here to be called from C#.
+ */
+
+void
+mono_debugger_server_static_init (void);
+
+void
+mono_debugger_server_global_init (void);
+
+ServerCapabilities
+mono_debugger_server_get_capabilities (void);
+
+ServerType
+mono_debugger_server_get_server_type (void);
+
+ServerHandle *
+mono_debugger_server_create_inferior (BreakpointManager *bpm);
+
+ServerCommandError
+mono_debugger_server_initialize_process (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_initialize_thread (ServerHandle *handle,
+ guint32 pid,
+ gboolean wait);
+
+void
+mono_debugger_server_io_thread_main (IOThreadData *io_data,
+ ChildOutputFunc func);
+
+ServerCommandError
+mono_debugger_server_spawn (ServerHandle *handle,
+ const gchar *working_directory,
+ const gchar **argv,
+ const gchar **envp,
+ gboolean redirect_fds,
+ gint *child_pid,
+ IOThreadData **io_data,
+ gchar **error);
+
+ServerCommandError
+mono_debugger_server_attach (ServerHandle *handle,
+ guint32 pid);
+
+void
+mono_debugger_server_finalize (ServerHandle *handle);
+
+guint32
+mono_debugger_server_global_wait (guint32 *status);
+
+ServerStatusMessageType
+mono_debugger_server_dispatch_event (ServerHandle *handle,
+ guint32 status,
+ guint64 *arg,
+ guint64 *data1,
+ guint64 *data2,
+ guint32 *opt_data_size,
+ gpointer *opt_data);
+
+ServerCommandError
+mono_debugger_server_get_target_info (guint32 *target_int_size,
+ guint32 *target_long_size,
+ guint32 *target_address_size,
+ guint32 *is_bigendian);
+
+ServerCommandError
+mono_debugger_server_get_frame (ServerHandle *handle,
+ StackFrame *frame);
+
+ServerCommandError
+mono_debugger_server_current_insn_is_bpt (ServerHandle *handle,
+ guint32 *is_breakpoint);
+
+ServerCommandError
+mono_debugger_server_step (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_continue (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_resume (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_detach (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_peek_word (ServerHandle *handle,
+ guint64 start,
+ guint64 *word);
+
+ServerCommandError
+mono_debugger_server_read_memory (ServerHandle *handle,
+ guint64 start,
+ guint32 size,
+ gpointer data);
+
+ServerCommandError
+mono_debugger_server_write_memory (ServerHandle *handle,
+ guint64 start,
+ guint32 size,
+ gconstpointer data);
+
+ServerCommandError
+mono_debugger_server_call_method (ServerHandle *handle,
+ guint64 method_address,
+ guint64 method_argument1,
+ guint64 method_argument2,
+ guint64 callback_argument);
+
+ServerCommandError
+mono_debugger_server_call_method_1 (ServerHandle *handle,
+ guint64 method_address,
+ guint64 method_argument,
+ guint64 data_argument,
+ guint64 data_argument2,
+ const gchar *string_argument,
+ guint64 callback_argument);
+
+ServerCommandError
+mono_debugger_server_call_method_2 (ServerHandle *handle,
+ guint64 method_address,
+ guint32 data_size,
+ gconstpointer data_buffer,
+ guint64 callback_argument);
+
+ServerCommandError
+mono_debugger_server_call_method_3 (ServerHandle *handle,
+ guint64 method_address,
+ guint64 method_argument,
+ guint64 address_argument,
+ guint32 blob_size,
+ gconstpointer blob_data,
+ guint64 callback_argument);
+
+ServerCommandError
+mono_debugger_server_call_method_invoke (ServerHandle *handle,
+ guint64 invoke_method,
+ guint64 method_argument,
+ guint32 num_params,
+ guint32 blob_size,
+ guint64 *param_data,
+ gint32 *offset_data,
+ gconstpointer blob_data,
+ guint64 callback_argument,
+ gboolean debug);
+
+ServerCommandError
+mono_debugger_execute_instruction (ServerHandle *handle,
+ const guint8 *instruction,
+ guint32 instruction_size,
+ gboolean update_ip);
+
+ServerCommandError
+mono_debugger_mark_rti_framenvoke (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_abort_invoke (ServerHandle *handle,
+ guint64 rti_id);
+
+ServerCommandError
+mono_debugger_server_insert_breakpoint (ServerHandle *handle,
+ guint64 address,
+ guint32 *breakpoint);
+
+ServerCommandError
+mono_debugger_server_insert_hw_breakpoint(ServerHandle *handle,
+ guint32 type,
+ guint32 *idx,
+ guint64 address,
+ guint32 *breakpoint);
+
+ServerCommandError
+mono_debugger_server_remove_breakpoint (ServerHandle *handle,
+ guint32 breakpoint);
+
+ServerCommandError
+mono_debugger_server_enable_breakpoint (ServerHandle *handle,
+ guint32 breakpoint);
+
+ServerCommandError
+mono_debugger_server_disable_breakpoint (ServerHandle *handle,
+ guint32 breakpoint);
+
+ServerCommandError
+mono_debugger_server_get_registers (ServerHandle *handle,
+ guint64 *values);
+
+ServerCommandError
+mono_debugger_server_set_registers (ServerHandle *handle,
+ guint64 *values);
+
+ServerCommandError
+mono_debugger_server_stop (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_stop_and_wait (ServerHandle *handle,
+ guint32 *status);
+
+ServerCommandError
+mono_debugger_server_set_signal (ServerHandle *handle,
+ guint32 sig,
+ guint32 send_it);
+
+ServerCommandError
+mono_debugger_server_get_pending_signal (ServerHandle *handle,
+ guint32 *signal);
+
+ServerCommandError
+mono_debugger_server_kill (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_get_signal_info (ServerHandle *handle,
+ SignalInfo **sinfo);
+
+void
+mono_debugger_server_set_runtime_info (ServerHandle *handle,
+ MonoRuntimeInfo *mono_runtime);
+
+ServerCommandError
+mono_debugger_server_get_threads (ServerHandle *handle,
+ guint32 *count,
+ guint32 **threads);
+
+ServerCommandError
+mono_debugger_server_get_application (ServerHandle *handle,
+ gchar **exe_file,
+ gchar **cwd,
+ guint32 *nargs,
+ gchar ***cmdline_args);
+
+ServerCommandError
+mono_debugger_server_detach_after_fork (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_push_registers (ServerHandle *handle,
+ guint64 *new_rsp);
+
+ServerCommandError
+mono_debugger_server_pop_registers (ServerHandle *handle);
+
+ServerCommandError
+mono_debugger_server_get_callback_frame (ServerHandle *handle,
+ guint64 stack_pointer,
+ gboolean exact_match,
+ CallbackInfo *info);
+
+ServerCommandError
+mono_debugger_server_restart_notification (ServerHandle *handle);
+
+MonoRuntimeInfo *
+mono_debugger_server_initialize_mono_runtime (guint32 address_size,
+ guint64 notification_address,
+ guint64 executable_code_buffer,
+ guint32 executable_code_buffer_size,
+ guint64 breakpoint_info_area,
+ guint64 breakpoint_table,
+ guint32 breakpoint_table_size);
+
+void
+mono_debugger_server_finalize_mono_runtime (MonoRuntimeInfo *runtime);
+
+void
+mono_debugger_server_initialize_code_buffer (MonoRuntimeInfo *runtime,
+ guint64 executable_code_buffer,
+ guint32 executable_code_buffer_size);
+
+void
+mono_debugger_server_get_registers_from_core_file (guint64 *values,
+ const guint8 *buffer);
+
+guint32
+mono_debugger_server_get_current_pid (void);
+
+guint64
+mono_debugger_server_get_current_thread (void);
+
+
+/* POSIX semaphores */
+
+void mono_debugger_server_sem_init (void);
+void mono_debugger_server_sem_wait (void);
+void mono_debugger_server_sem_post (void);
+int mono_debugger_server_sem_get_value (void);
+
+int mono_debugger_server_get_pending_sigint (void);
+
+G_END_DECLS
+
+#endif
diff --git a/sysdeps/server/thread-db.c b/backend/server/thread-db.c
similarity index 100%
rename from sysdeps/server/thread-db.c
rename to backend/server/thread-db.c
diff --git a/sysdeps/server/thread-db.h b/backend/server/thread-db.h
similarity index 100%
rename from sysdeps/server/thread-db.h
rename to backend/server/thread-db.h
diff --git a/sysdeps/server/x86-arch.h b/backend/server/x86-arch.h
similarity index 100%
rename from sysdeps/server/x86-arch.h
rename to backend/server/x86-arch.h
diff --git a/backend/server/x86-linux-ptrace.c b/backend/server/x86-linux-ptrace.c
new file mode 100644
index 0000000..8315fb9
--- /dev/null
+++ b/backend/server/x86-linux-ptrace.c
@@ -0,0 +1,720 @@
+static sem_t manager_semaphore;
+
+static void
+server_ptrace_sem_init (void)
+{
+ sem_init (&manager_semaphore, 1, 0);
+}
+
+static void
+server_ptrace_sem_wait (void)
+{
+ sem_wait (&manager_semaphore);
+}
+
+static void
+server_ptrace_sem_post (void)
+{
+ sem_post (&manager_semaphore);
+}
+
+static int
+server_ptrace_sem_get_value (void)
+{
+ int ret;
+
+ sem_getvalue (&manager_semaphore, &ret);
+ return ret;
+}
+
+static ServerType
+server_ptrace_get_server_type (void)
+{
+ return SERVER_TYPE_LINUX_PTRACE;
+}
+
+static ServerCapabilities
+server_ptrace_get_capabilities (void)
+{
+ return SERVER_CAPABILITIES_THREAD_EVENTS | SERVER_CAPABILITIES_CAN_DETACH_ANY;
+}
+
+static ServerCommandError
+_server_ptrace_check_errno (InferiorHandle *inferior)
+{
+ gchar *filename;
+
+ if (!errno)
+ return COMMAND_ERROR_NONE;
+ else if (errno != ESRCH) {
+ g_message (G_STRLOC ": %d - %s", inferior->pid, g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ filename = g_strdup_printf ("/proc/%d/stat", inferior->pid);
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ g_free (filename);
+ return COMMAND_ERROR_NOT_STOPPED;
+ }
+
+ g_warning (G_STRLOC ": %d - %s - %d (%s)", inferior->pid, filename,
+ errno, g_strerror (errno));
+ g_free (filename);
+ return COMMAND_ERROR_NO_TARGET;
+}
+
+static ServerCommandError
+_server_ptrace_make_memory_executable (ServerHandle *handle, guint64 start, guint32 size)
+{
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_get_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs)
+{
+ if (ptrace (PT_GETREGS, inferior->pid, NULL, regs) != 0)
+ return _server_ptrace_check_errno (inferior);
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_set_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs)
+{
+ if (ptrace (PT_SETREGS, inferior->pid, NULL, regs) != 0)
+ return _server_ptrace_check_errno (inferior);
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_get_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs)
+{
+ if (ptrace (PT_GETFPREGS, inferior->pid, NULL, regs) != 0)
+ return _server_ptrace_check_errno (inferior);
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_set_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs)
+{
+ if (ptrace (PT_SETFPREGS, inferior->pid, NULL, regs) != 0)
+ return _server_ptrace_check_errno (inferior);
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer buffer)
+{
+ guint8 *ptr = buffer;
+ guint32 old_size = size;
+
+ while (size) {
+ int ret = pread64 (handle->inferior->os.mem_fd, ptr, size, start);
+ if (ret < 0) {
+ if (errno == EINTR)
+ continue;
+ else if (errno == ESRCH)
+ return COMMAND_ERROR_NOT_STOPPED;
+ else if (errno == EIO)
+ return COMMAND_ERROR_MEMORY_ACCESS;
+ return COMMAND_ERROR_MEMORY_ACCESS;
+ }
+
+ size -= ret;
+ ptr += ret;
+ }
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer buffer)
+{
+ ServerCommandError result = _server_ptrace_read_memory (handle, start, size, buffer);
+ if (result != COMMAND_ERROR_NONE)
+ return result;
+ x86_arch_remove_breakpoints_from_target_memory (handle, start, size, buffer);
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_write_memory (ServerHandle *handle, guint64 start,
+ guint32 size, gconstpointer buffer)
+{
+ InferiorHandle *inferior = handle->inferior;
+ ServerCommandError result;
+ const long *ptr = buffer;
+ guint64 addr = start;
+ char temp [8];
+
+ while (size >= sizeof (long)) {
+ long word = *ptr++;
+
+ errno = 0;
+ if (ptrace (PT_WRITE_D, inferior->pid, GSIZE_TO_POINTER (addr), word) != 0)
+ return _server_ptrace_check_errno (inferior);
+
+ addr += sizeof (long);
+ size -= sizeof (long);
+ }
+
+ if (!size)
+ return COMMAND_ERROR_NONE;
+
+ result = _server_ptrace_read_memory (handle, addr, sizeof (long), &temp);
+ if (result != COMMAND_ERROR_NONE)
+ return result;
+
+ memcpy (&temp, ptr, size);
+
+ return server_ptrace_write_memory (handle, addr, sizeof (long), &temp);
+}
+
+static ServerCommandError
+server_ptrace_poke_word (ServerHandle *handle, guint64 addr, gsize value)
+{
+ errno = 0;
+ if (ptrace (PT_WRITE_D, handle->inferior->pid, GSIZE_TO_POINTER (addr), value) != 0)
+ return _server_ptrace_check_errno (handle->inferior);
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_set_dr (InferiorHandle *handle, int regnum, guint64 value)
+{
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, handle->pid, offsetof (struct user, u_debugreg [regnum]), value);
+ if (errno) {
+ g_message (G_STRLOC ": %d - %d - %s", handle->pid, regnum, g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ return COMMAND_ERROR_NONE;
+}
+
+
+static ServerCommandError
+_server_ptrace_get_dr (InferiorHandle *handle, int regnum, guint64 *value)
+{
+ int ret;
+
+ errno = 0;
+ ret = ptrace (PTRACE_PEEKUSER, handle->pid, offsetof (struct user, u_debugreg [regnum]));
+ if (errno) {
+ g_message (G_STRLOC ": %d - %d - %s", handle->pid, regnum, g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ *value = ret;
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_continue (ServerHandle *handle)
+{
+ InferiorHandle *inferior = handle->inferior;
+
+ errno = 0;
+ inferior->stepping = FALSE;
+ if (ptrace (PT_CONTINUE, inferior->pid, (caddr_t) 1, inferior->last_signal)) {
+ return _server_ptrace_check_errno (inferior);
+ }
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_step (ServerHandle *handle)
+{
+ InferiorHandle *inferior = handle->inferior;
+
+ errno = 0;
+ inferior->stepping = TRUE;
+ if (ptrace (PT_STEP, inferior->pid, (caddr_t) 1, inferior->last_signal))
+ return _server_ptrace_check_errno (inferior);
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_kill (ServerHandle *handle)
+{
+ if (ptrace (PTRACE_KILL, handle->inferior->pid, NULL, 0))
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+
+ return COMMAND_ERROR_NONE;
+}
+
+GStaticMutex wait_mutex = G_STATIC_MUTEX_INIT;
+GStaticMutex wait_mutex_2 = G_STATIC_MUTEX_INIT;
+GStaticMutex wait_mutex_3 = G_STATIC_MUTEX_INIT;
+
+static int
+do_wait (int pid, guint32 *status, gboolean nohang)
+{
+ int ret, flags;
+
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": do_wait (%d%s)", pid, nohang ? ",nohang" : "");
+#endif
+ flags = WUNTRACED | __WALL | __WCLONE;
+ if (nohang)
+ flags |= WNOHANG;
+ ret = waitpid (pid, status, flags);
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": do_wait (%d) finished: %d - %x", pid, ret, *status);
+#endif
+ if (ret < 0) {
+ if (errno == EINTR)
+ return 0;
+ else if (errno == ECHILD)
+ return -1;
+ g_warning (G_STRLOC ": Can't waitpid for %d: %s", pid, g_strerror (errno));
+ return -1;
+ }
+
+ return ret;
+}
+
+static int stop_requested = 0;
+static int stop_status = 0;
+
+static guint32
+server_ptrace_global_wait (guint32 *status_ret)
+{
+ int ret, status;
+
+ again:
+ g_static_mutex_lock (&wait_mutex);
+ ret = do_wait (-1, &status, FALSE);
+ if (ret <= 0)
+ goto out;
+
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": global wait finished: %d - %x", ret, status);
+#endif
+
+ g_static_mutex_lock (&wait_mutex_2);
+
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": global wait finished #1: %d - %x - %d",
+ ret, status, stop_requested);
+#endif
+
+ if (ret == stop_requested) {
+ *status_ret = 0;
+ stop_status = status;
+ g_static_mutex_unlock (&wait_mutex_2);
+ g_static_mutex_unlock (&wait_mutex);
+
+ g_static_mutex_lock (&wait_mutex_3);
+ g_static_mutex_unlock (&wait_mutex_3);
+ goto again;
+ }
+ g_static_mutex_unlock (&wait_mutex_2);
+
+ *status_ret = status;
+ out:
+ g_static_mutex_unlock (&wait_mutex);
+ return ret;
+}
+
+static gboolean
+_server_ptrace_wait_for_new_thread (ServerHandle *handle)
+{
+ guint32 ret, status = 0;
+
+ /*
+ * There is a race condition in the Linux kernel which shows up on >= 2.6.27:
+ *
+ * When creating a new thread, the initial stopping event of that thread is sometimes
+ * sent before sending the `PTRACE_EVENT_CLONE' for it.
+ *
+ * Because of this, we wait here until the new thread has been stopped and ignore
+ * any "early" stopping events.
+ *
+ * See also bugs #423518 and #466012.
+. *
+ */
+
+ if (!g_static_mutex_trylock (&wait_mutex)) {
+ /* This should never happen, but let's not deadlock here. */
+ g_warning (G_STRLOC ": Can't lock mutex: %d", handle->inferior->pid);
+ return FALSE;
+ }
+
+ /*
+ * We own the `wait_mutex', so no other thread is currently waiting for the target
+ * and we can safely wait for it here.
+ */
+
+ ret = waitpid (handle->inferior->pid, &status, WUNTRACED | __WALL | __WCLONE);
+
+ /*
+ * Safety check: make sure we got the correct event.
+ */
+
+ if ((ret != handle->inferior->pid) || !WIFSTOPPED (status) ||
+ ((WSTOPSIG (status) != SIGSTOP) && (WSTOPSIG (status) != SIGTRAP))) {
+ g_warning (G_STRLOC ": Wait failed: %d, got pid %d, status %x", handle->inferior->pid, ret, status);
+ g_static_mutex_unlock (&wait_mutex);
+ return FALSE;
+ }
+
+ /*
+ * Just as an extra safety check.
+ */
+
+ if (x86_arch_get_registers (handle) != COMMAND_ERROR_NONE) {
+ g_static_mutex_unlock (&wait_mutex);
+ g_warning (G_STRLOC ": Failed to get registers: %d", handle->inferior->pid);
+ return FALSE;
+ }
+
+ g_static_mutex_unlock (&wait_mutex);
+ return TRUE;
+}
+
+static ServerCommandError
+server_ptrace_stop (ServerHandle *handle)
+{
+ ServerCommandError result;
+
+ /*
+ * Try to get the thread's registers. If we suceed, then it's already stopped
+ * and still alive.
+ */
+ result = x86_arch_get_registers (handle);
+ if (result == COMMAND_ERROR_NONE)
+ return COMMAND_ERROR_ALREADY_STOPPED;
+
+ if (syscall (__NR_tkill, handle->inferior->pid, SIGSTOP)) {
+ /*
+ * It's already dead.
+ */
+ if (errno == ESRCH)
+ return COMMAND_ERROR_NO_TARGET;
+ else
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_stop_and_wait (ServerHandle *handle, guint32 *status)
+{
+ ServerCommandError result;
+ gboolean already_stopped = FALSE;
+ int ret;
+
+ /*
+ * Try to get the thread's registers. If we suceed, then it's already stopped
+ * and still alive.
+ */
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": stop and wait %d", handle->inferior->pid);
+#endif
+ g_static_mutex_lock (&wait_mutex_2);
+ result = server_ptrace_stop (handle);
+ if (result == COMMAND_ERROR_ALREADY_STOPPED) {
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": %d - already stopped", handle->inferior->pid);
+#endif
+ already_stopped = TRUE;
+ } else if (result != COMMAND_ERROR_NONE) {
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": %d - cannot stop %d", handle->inferior->pid, result);
+#endif
+
+ g_static_mutex_unlock (&wait_mutex_2);
+ return result;
+ }
+
+ g_static_mutex_lock (&wait_mutex_3);
+
+ stop_requested = handle->inferior->pid;
+ g_static_mutex_unlock (&wait_mutex_2);
+
+#if DEBUG_WAIT
+ if (!already_stopped)
+ g_message (G_STRLOC ": %d - sent SIGSTOP", handle->inferior->pid);
+#endif
+
+ g_static_mutex_lock (&wait_mutex);
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": %d - got stop status %x", handle->inferior->pid, stop_status);
+#endif
+ if (stop_status) {
+ *status = stop_status;
+ stop_requested = stop_status = 0;
+ g_static_mutex_unlock (&wait_mutex);
+ g_static_mutex_unlock (&wait_mutex_3);
+ return COMMAND_ERROR_NONE;
+ }
+
+ stop_requested = stop_status = 0;
+
+ do {
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": %d - waiting", handle->inferior->pid);
+#endif
+ ret = do_wait (handle->inferior->pid, status, already_stopped);
+#if DEBUG_WAIT
+ g_message (G_STRLOC ": %d - done waiting %d, %x",
+ handle->inferior->pid, ret, status);
+#endif
+ } while (ret == 0);
+ g_static_mutex_unlock (&wait_mutex);
+ g_static_mutex_unlock (&wait_mutex_3);
+
+ /*
+ * Should never happen.
+ */
+ if (ret < 0)
+ return COMMAND_ERROR_NO_TARGET;
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+_server_ptrace_setup_inferior (ServerHandle *handle)
+{
+ gchar *filename = g_strdup_printf ("/proc/%d/mem", handle->inferior->pid);
+
+ x86_arch_remove_hardware_breakpoints (handle);
+
+ handle->inferior->os.mem_fd = open64 (filename, O_RDONLY);
+
+ if (handle->inferior->os.mem_fd < 0) {
+ if (errno == EACCES)
+ return COMMAND_ERROR_PERMISSION_DENIED;
+
+ g_warning (G_STRLOC ": Can't open (%s): %s", filename, g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ g_free (filename);
+ return COMMAND_ERROR_NONE;
+}
+
+static void
+_server_ptrace_finalize_inferior (ServerHandle *handle)
+{
+ close (handle->inferior->os.mem_fd);
+ handle->inferior->os.mem_fd = -1;
+}
+
+static ServerCommandError
+server_ptrace_initialize_process (ServerHandle *handle)
+{
+ int flags = PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK |
+ PTRACE_O_TRACEEXEC;
+
+ if (ptrace (PTRACE_SETOPTIONS, handle->inferior->pid, 0, flags)) {
+ g_warning (G_STRLOC ": Can't PTRACE_SETOPTIONS %d: %s",
+ handle->inferior->pid, g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_get_signal_info (ServerHandle *handle, SignalInfo **sinfo_out)
+{
+ SignalInfo *sinfo = g_new0 (SignalInfo, 1);
+
+ sinfo->sigkill = SIGKILL;
+ sinfo->sigstop = SIGSTOP;
+ sinfo->sigint = SIGINT;
+ sinfo->sigchld = SIGCHLD;
+
+ sinfo->sigfpe = SIGFPE;
+ sinfo->sigquit = SIGQUIT;
+ sinfo->sigabrt = SIGABRT;
+ sinfo->sigsegv = SIGSEGV;
+ sinfo->sigill = SIGILL;
+ sinfo->sigbus = SIGBUS;
+ sinfo->sigwinch = SIGWINCH;
+
+ /* __SIGRTMIN is the hard limit from the kernel, SIGRTMIN is the first
+ * user-visible real-time signal. __SIGRTMIN and __SIGRTMIN+1 are used
+ * internally by glibc. */
+ sinfo->kernel_sigrtmin = __SIGRTMIN;
+ sinfo->mono_thread_abort = mono_thread_get_abort_signal ();
+
+ *sinfo_out = sinfo;
+
+ return COMMAND_ERROR_NONE;
+}
+
+static void
+server_ptrace_global_init (void)
+{
+ stop_requested = 0;
+ stop_status = 0;
+}
+
+static ServerCommandError
+server_ptrace_get_threads (ServerHandle *handle, guint32 *count, guint32 **threads)
+{
+ gchar *dirname = g_strdup_printf ("/proc/%d/task", handle->inferior->pid);
+ const gchar *filename;
+ GPtrArray *array;
+ GDir *dir;
+ int i;
+
+ dir = g_dir_open (dirname, 0, NULL);
+ if (!dir) {
+ g_warning (G_STRLOC ": Can't get threads of %d", handle->inferior->pid);
+ g_free (dirname);
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ array = g_ptr_array_new ();
+
+ while ((filename = g_dir_read_name (dir)) != NULL) {
+ gchar *endptr;
+ guint32 pid;
+
+ pid = (guint32) strtol (filename, &endptr, 10);
+ if (*endptr)
+ goto out_error;
+
+ g_ptr_array_add (array, GUINT_TO_POINTER (pid));
+ }
+
+ *count = array->len;
+ *threads = g_new0 (guint32, array->len);
+
+ for (i = 0; i < array->len; i++)
+ (*threads) [i] = GPOINTER_TO_UINT (g_ptr_array_index (array, i));
+
+ g_free (dirname);
+ g_dir_close (dir);
+ g_ptr_array_free (array, FALSE);
+ return COMMAND_ERROR_NONE;
+
+ out_error:
+ g_free (dirname);
+ g_dir_close (dir);
+ g_ptr_array_free (array, FALSE);
+ g_warning (G_STRLOC ": Can't get threads of %d", handle->inferior->pid);
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+}
+
+static ServerCommandError
+server_ptrace_get_application (ServerHandle *handle, gchar **exe_file, gchar **cwd,
+ guint32 *nargs, gchar ***cmdline_args)
+{
+ gchar *exe_filename = g_strdup_printf ("/proc/%d/exe", handle->inferior->pid);
+ gchar *cwd_filename = g_strdup_printf ("/proc/%d/cwd", handle->inferior->pid);
+ gchar *cmdline_filename = g_strdup_printf ("/proc/%d/cmdline", handle->inferior->pid);
+ char buffer [BUFSIZ+1];
+ GPtrArray *array;
+ gchar *cmdline, **ptr;
+ gssize pos, len;
+ int i;
+
+ len = readlink (exe_filename, buffer, BUFSIZ);
+ if (len < 0) {
+ g_free (cwd_filename);
+ g_free (exe_filename);
+ g_free (cmdline_filename);
+
+ if (errno == EACCES)
+ return COMMAND_ERROR_PERMISSION_DENIED;
+
+ g_warning (G_STRLOC ": Can't get exe file of %d: %s", handle->inferior->pid,
+ g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ buffer [len] = 0;
+ *exe_file = g_strdup (buffer);
+
+ len = readlink (cwd_filename, buffer, BUFSIZ);
+ if (len < 0) {
+ g_free (cwd_filename);
+ g_free (exe_filename);
+ g_free (cmdline_filename);
+ g_warning (G_STRLOC ": Can't get cwd of %d: %s", handle->inferior->pid,
+ g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ buffer [len] = 0;
+ *cwd = g_strdup (buffer);
+
+ if (!g_file_get_contents (cmdline_filename, &cmdline, &len, NULL)) {
+ g_free (cwd_filename);
+ g_free (exe_filename);
+ g_free (cmdline_filename);
+ g_warning (G_STRLOC ": Can't get cmdline args of %d", handle->inferior->pid);
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ array = g_ptr_array_new ();
+
+ pos = 0;
+ while (pos < len) {
+ g_ptr_array_add (array, cmdline + pos);
+ pos += strlen (cmdline + pos) + 1;
+ }
+
+ *nargs = array->len;
+ *cmdline_args = ptr = g_new0 (gchar *, array->len + 1);
+
+ for (i = 0; i < array->len; i++)
+ ptr [i] = g_ptr_array_index (array, i);
+
+ g_free (cwd_filename);
+ g_free (exe_filename);
+ g_free (cmdline_filename);
+ g_ptr_array_free (array, FALSE);
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_detach_after_fork (ServerHandle *handle)
+{
+ ServerCommandError result;
+ GPtrArray *breakpoints;
+ guint32 status;
+ int ret, i;
+
+ ret = waitpid (handle->inferior->pid, &status, WUNTRACED | WNOHANG | __WALL | __WCLONE);
+ if (ret < 0)
+ g_warning (G_STRLOC ": Can't waitpid for %d: %s", handle->inferior->pid, g_strerror (errno));
+
+ /*
+ * Make sure we're stopped.
+ */
+ if (x86_arch_get_registers (handle) != COMMAND_ERROR_NONE)
+ do_wait (handle->inferior->pid, &status, FALSE);
+
+ result = x86_arch_get_registers (handle);
+ if (result != COMMAND_ERROR_NONE)
+ return result;
+
+ mono_debugger_breakpoint_manager_lock ();
+
+ breakpoints = mono_debugger_breakpoint_manager_get_breakpoints (handle->bpm);
+ for (i = 0; i < breakpoints->len; i++) {
+ BreakpointInfo *info = g_ptr_array_index (breakpoints, i);
+
+ x86_arch_disable_breakpoint (handle, info);
+ }
+
+ mono_debugger_breakpoint_manager_unlock ();
+
+ if (ptrace (PT_DETACH, handle->inferior->pid, NULL, NULL) != 0)
+ return _server_ptrace_check_errno (handle->inferior);
+
+ return COMMAND_ERROR_NONE;
+}
diff --git a/sysdeps/server/x86-linux-ptrace.h b/backend/server/x86-linux-ptrace.h
similarity index 100%
rename from sysdeps/server/x86-linux-ptrace.h
rename to backend/server/x86-linux-ptrace.h
diff --git a/backend/server/x86-ptrace.c b/backend/server/x86-ptrace.c
new file mode 100644
index 0000000..5bf55a9
--- /dev/null
+++ b/backend/server/x86-ptrace.c
@@ -0,0 +1,702 @@
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <config.h>
+#include <server.h>
+#include <breakpoints.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <sys/stat.h>
+#include <sys/ptrace.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <sys/poll.h>
+#include <sys/select.h>
+#include <sys/resource.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/object.h>
+
+/*
+ * NOTE: The manpage is wrong about the POKE_* commands - the last argument
+ * is the data (a word) to be written, not a pointer to it.
+ *
+ * In general, the ptrace(2) manpage is very bad, you should really read
+ * kernel/ptrace.c and arch/i386/kernel/ptrace.c in the Linux source code
+ * to get a better understanding for this stuff.
+ */
+
+#ifdef __linux__
+#include "x86-linux-ptrace.h"
+#endif
+
+#ifdef __FreeBSD__
+#include "x86-freebsd-ptrace.h"
+#endif
+
+#ifdef __MACH__
+#include "darwin-ptrace.h"
+#endif
+
+#include "x86-arch.h"
+
+struct IOThreadData
+{
+ int output_fd, error_fd;
+};
+
+MonoRuntimeInfo *
+mono_debugger_server_initialize_mono_runtime (guint32 address_size,
+ guint64 notification_address,
+ guint64 executable_code_buffer,
+ guint32 executable_code_buffer_size,
+ guint64 breakpoint_info_area,
+ guint64 breakpoint_table,
+ guint32 breakpoint_table_size)
+{
+ MonoRuntimeInfo *runtime = g_new0 (MonoRuntimeInfo, 1);
+
+ runtime->address_size = address_size;
+ runtime->notification_address = notification_address;
+ runtime->executable_code_buffer = executable_code_buffer;
+ runtime->executable_code_buffer_size = executable_code_buffer_size;
+ runtime->executable_code_chunk_size = EXECUTABLE_CODE_CHUNK_SIZE;
+ runtime->executable_code_total_chunks = executable_code_buffer_size / EXECUTABLE_CODE_CHUNK_SIZE;
+
+ runtime->breakpoint_info_area = breakpoint_info_area;
+ runtime->breakpoint_table = breakpoint_table;
+ runtime->breakpoint_table_size = breakpoint_table_size;
+
+ runtime->breakpoint_table_bitfield = g_malloc0 (breakpoint_table_size);
+ runtime->executable_code_bitfield = g_malloc0 (runtime->executable_code_total_chunks);
+
+ return runtime;
+}
+
+void
+mono_debugger_server_initialize_code_buffer (MonoRuntimeInfo *runtime,
+ guint64 executable_code_buffer,
+ guint32 executable_code_buffer_size)
+{
+ runtime->executable_code_buffer = executable_code_buffer;
+ runtime->executable_code_buffer_size = executable_code_buffer_size;
+ runtime->executable_code_chunk_size = EXECUTABLE_CODE_CHUNK_SIZE;
+ runtime->executable_code_total_chunks = executable_code_buffer_size / EXECUTABLE_CODE_CHUNK_SIZE;
+}
+
+void
+mono_debugger_server_finalize_mono_runtime (MonoRuntimeInfo *runtime)
+{
+ runtime->executable_code_buffer = 0;
+}
+
+static void
+server_ptrace_finalize (ServerHandle *handle)
+{
+ x86_arch_finalize (handle->arch);
+
+ _server_ptrace_finalize_inferior (handle);
+
+ g_free (handle->inferior);
+ g_free (handle);
+}
+
+#ifndef __MACH__
+#endif
+
+static ServerCommandError
+server_ptrace_resume (ServerHandle *handle)
+{
+ InferiorHandle *inferior = handle->inferior;
+ if (inferior->stepping)
+ return server_ptrace_step (handle);
+ else
+ return server_ptrace_continue (handle);
+}
+
+static ServerCommandError
+server_ptrace_detach (ServerHandle *handle)
+{
+ InferiorHandle *inferior = handle->inferior;
+
+ if (ptrace (PT_DETACH, inferior->pid, NULL, 0)) {
+ g_message (G_STRLOC ": %d - %s", inferior->pid, g_strerror (errno));
+ return COMMAND_ERROR_UNKNOWN_ERROR;
+ }
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_peek_word (ServerHandle *handle, guint64 start, guint64 *retval)
+{
+ return server_ptrace_read_memory (handle, start, sizeof (gsize), retval);
+}
+
+static ServerStatusMessageType
+server_ptrace_dispatch_event (ServerHandle *handle, guint32 status, guint64 *arg,
+ guint64 *data1, guint64 *data2, guint32 *opt_data_size,
+ gpointer *opt_data)
+{
+ #ifdef PTRACE_EVENT_CLONE
+ if (status >> 16) {
+ switch (status >> 16) {
+ case PTRACE_EVENT_CLONE: {
+ int new_pid;
+
+ if (ptrace (PTRACE_GETEVENTMSG, handle->inferior->pid, 0, &new_pid)) {
+ g_warning (G_STRLOC ": %d - %s", handle->inferior->pid,
+ g_strerror (errno));
+ return FALSE;
+ }
+
+ *arg = new_pid;
+ return MESSAGE_CHILD_CREATED_THREAD;
+ }
+
+ case PTRACE_EVENT_FORK: {
+ int new_pid;
+
+ if (ptrace (PTRACE_GETEVENTMSG, handle->inferior->pid, 0, &new_pid)) {
+ g_warning (G_STRLOC ": %d - %s", handle->inferior->pid,
+ g_strerror (errno));
+ return FALSE;
+ }
+
+ *arg = new_pid;
+ return MESSAGE_CHILD_FORKED;
+ }
+
+ case PTRACE_EVENT_EXEC:
+ return MESSAGE_CHILD_EXECD;
+
+ case PTRACE_EVENT_EXIT: {
+ int exitcode;
+
+ if (ptrace (PTRACE_GETEVENTMSG, handle->inferior->pid, 0, &exitcode)) {
+ g_warning (G_STRLOC ": %d - %s", handle->inferior->pid,
+ g_strerror (errno));
+ return FALSE;
+ }
+
+ *arg = 0;
+ return MESSAGE_CHILD_CALLED_EXIT;
+ }
+
+ default:
+ g_warning (G_STRLOC ": Received unknown wait result %x on child %d",
+ status, handle->inferior->pid);
+ return MESSAGE_UNKNOWN_ERROR;
+ }
+ }
+ #endif
+
+ if (WIFSTOPPED (status)) {
+#if __MACH__
+ handle->inferior->os.wants_to_run = FALSE;
+#endif
+ guint64 callback_arg, retval, retval2;
+ ChildStoppedAction action;
+ int stopsig;
+
+ stopsig = WSTOPSIG (status);
+ if (stopsig == SIGCONT)
+ stopsig = 0;
+
+ action = x86_arch_child_stopped (
+ handle, stopsig, &callback_arg, &retval, &retval2, opt_data_size, opt_data);
+
+ if (action != STOP_ACTION_STOPPED)
+ handle->inferior->last_signal = 0;
+
+ switch (action) {
+ case STOP_ACTION_STOPPED:
+ if (stopsig == SIGTRAP) {
+ handle->inferior->last_signal = 0;
+ *arg = 0;
+ } else {
+ handle->inferior->last_signal = stopsig;
+ *arg = stopsig;
+ }
+ return MESSAGE_CHILD_STOPPED;
+
+ case STOP_ACTION_INTERRUPTED:
+ *arg = 0;
+ return MESSAGE_CHILD_INTERRUPTED;
+
+ case STOP_ACTION_BREAKPOINT_HIT:
+ *arg = (int) retval;
+ return MESSAGE_CHILD_HIT_BREAKPOINT;
+
+ case STOP_ACTION_CALLBACK:
+ *arg = callback_arg;
+ *data1 = retval;
+ *data2 = retval2;
+ return MESSAGE_CHILD_CALLBACK;
+
+ case STOP_ACTION_CALLBACK_COMPLETED:
+ *arg = callback_arg;
+ *data1 = retval;
+ *data2 = retval2;
+ return MESSAGE_CHILD_CALLBACK_COMPLETED;
+
+ case STOP_ACTION_NOTIFICATION:
+ *arg = callback_arg;
+ *data1 = retval;
+ *data2 = retval2;
+ return MESSAGE_CHILD_NOTIFICATION;
+
+ case STOP_ACTION_RTI_DONE:
+ *arg = callback_arg;
+ *data1 = retval;
+ *data2 = retval2;
+ return MESSAGE_RUNTIME_INVOKE_DONE;
+
+ case STOP_ACTION_INTERNAL_ERROR:
+ return MESSAGE_INTERNAL_ERROR;
+ }
+
+ g_assert_not_reached ();
+ } else if (WIFEXITED (status)) {
+ *arg = WEXITSTATUS (status);
+ return MESSAGE_CHILD_EXITED;
+ } else if (WIFSIGNALED (status)) {
+ if ((WTERMSIG (status) == SIGTRAP) || (WTERMSIG (status) == SIGKILL)) {
+ *arg = 0;
+ return MESSAGE_CHILD_EXITED;
+ } else {
+ *arg = WTERMSIG (status);
+ return MESSAGE_CHILD_SIGNALED;
+ }
+ }
+
+ g_warning (G_STRLOC ": Got unknown waitpid() result: %x", status);
+ return MESSAGE_UNKNOWN_ERROR;
+}
+
+static ServerStatusMessageType
+server_ptrace_dispatch_simple (guint32 status, guint32 *arg)
+{
+ if (status >> 16)
+ return MESSAGE_UNKNOWN_ERROR;
+
+ if (WIFSTOPPED (status)) {
+ int stopsig = WSTOPSIG (status);
+
+ if ((stopsig == SIGSTOP) || (stopsig == SIGTRAP))
+ stopsig = 0;
+
+ *arg = stopsig;
+ return MESSAGE_CHILD_STOPPED;
+ } else if (WIFEXITED (status)) {
+ *arg = WEXITSTATUS (status);
+ return MESSAGE_CHILD_EXITED;
+ } else if (WIFSIGNALED (status)) {
+ if ((WTERMSIG (status) == SIGTRAP) || (WTERMSIG (status) == SIGKILL)) {
+ *arg = 0;
+ return MESSAGE_CHILD_EXITED;
+ } else {
+ *arg = WTERMSIG (status);
+ return MESSAGE_CHILD_SIGNALED;
+ }
+ }
+
+ return MESSAGE_UNKNOWN_ERROR;
+}
+
+
+static ServerHandle *
+server_ptrace_create_inferior (BreakpointManager *bpm)
+{
+ ServerHandle *handle = g_new0 (ServerHandle, 1);
+
+ if ((getuid () == 0) || (geteuid () == 0)) {
+ g_message ("WARNING: Running mdb as root may be a problem because setuid() and\n"
+ "seteuid() do nothing.\n"
+ "See http://primates.ximian.com/~martin/blog/entry_150.html for details.");
+ }
+
+ handle->bpm = bpm;
+ handle->inferior = g_new0 (InferiorHandle, 1);
+ handle->arch = x86_arch_initialize ();
+
+ return handle;
+}
+
+static void
+child_setup_func (InferiorHandle *inferior)
+{
+ if (ptrace (PT_TRACE_ME, getpid (), NULL, 0))
+ g_error (G_STRLOC ": Can't PT_TRACEME: %s", g_strerror (errno));
+
+ if (inferior->redirect_fds) {
+ dup2 (inferior->output_fd[1], 1);
+ dup2 (inferior->error_fd[1], 2);
+ }
+}
+
+static ServerCommandError
+server_ptrace_spawn (ServerHandle *handle, const gchar *working_directory,
+ const gchar **argv, const gchar **envp, gboolean redirect_fds,
+ gint *child_pid, IOThreadData **io_data, gchar **error)
+{
+ InferiorHandle *inferior = handle->inferior;
+ int fd[2], ret, len, i;
+ ServerCommandError result;
+
+ *error = NULL;
+ inferior->redirect_fds = redirect_fds;
+
+ if (redirect_fds) {
+ pipe (inferior->output_fd);
+ pipe (inferior->error_fd);
+
+ *io_data = g_new0 (IOThreadData, 1);
+ (*io_data)->output_fd = inferior->output_fd[0];
+ (*io_data)->error_fd = inferior->error_fd[0];
+ } else {
+ *io_data = NULL;
+ }
+
+ pipe (fd);
+
+ *child_pid = fork ();
+ if (*child_pid == 0) {
+ gchar *error_message;
+ struct rlimit core_limit;
+ int open_max;
+
+ open_max = sysconf (_SC_OPEN_MAX);
+ for (i = 3; i < open_max; i++)
+ fcntl (i, F_SETFD, FD_CLOEXEC);
+
+ setsid ();
+
+ getrlimit (RLIMIT_CORE, &core_limit);
+ core_limit.rlim_cur = 0;
+ setrlimit (RLIMIT_CORE, &core_limit);
+
+ child_setup_func (inferior);
+ execve (argv [0], (char **) argv, (char **) envp);
+
+ error_message = g_strdup_printf ("Cannot exec `%s': %s", argv [0], g_strerror (errno));
+ len = strlen (error_message) + 1;
+ write (fd [1], &len, sizeof (len));
+ write (fd [1], error_message, len);
+ _exit (1);
+ } else if (*child_pid < 0) {
+ if (redirect_fds) {
+ close (inferior->output_fd[0]);
+ close (inferior->output_fd[1]);
+ close (inferior->error_fd[0]);
+ close (inferior->error_fd[1]);
+ }
+ close (fd [0]);
+ close (fd [1]);
+
+ *error = g_strdup_printf ("fork() failed: %s", g_strerror (errno));
+ return COMMAND_ERROR_CANNOT_START_TARGET;
+ }
+
+ if (redirect_fds) {
+ close (inferior->output_fd[1]);
+ close (inferior->error_fd[1]);
+ }
+ close (fd [1]);
+
+ ret = read (fd [0], &len, sizeof (len));
+
+ if (ret != 0) {
+ g_assert (ret == 4);
+
+ *error = g_malloc0 (len);
+ read (fd [0], *error, len);
+ close (fd [0]);
+ if (redirect_fds) {
+ close (inferior->output_fd[0]);
+ close (inferior->error_fd[0]);
+ }
+ return COMMAND_ERROR_CANNOT_START_TARGET;
+ }
+
+ close (fd [0]);
+
+ inferior->pid = *child_pid;
+
+#ifndef __MACH__
+ if (!_server_ptrace_wait_for_new_thread (handle))
+ return COMMAND_ERROR_INTERNAL_ERROR;
+#endif
+
+ result = _server_ptrace_setup_inferior (handle);
+ if (result != COMMAND_ERROR_NONE) {
+ if (redirect_fds) {
+ close (inferior->output_fd[0]);
+ close (inferior->error_fd[0]);
+ }
+ return result;
+ }
+
+#ifdef __MACH__
+ *child_pid = COMPOSED_PID(inferior->pid, inferior->os.thread_index);
+#endif
+
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_initialize_thread (ServerHandle *handle, guint32 pid, gboolean wait)
+{
+ InferiorHandle *inferior = handle->inferior;
+
+ inferior->is_thread = TRUE;
+
+#ifdef __MACH__
+ inferior->pid = GET_PID(pid);
+ inferior->os.thread = get_thread_from_index(GET_THREAD_INDEX(pid));
+#else
+ inferior->pid = pid;
+ if (wait && !_server_ptrace_wait_for_new_thread (handle))
+ return COMMAND_ERROR_INTERNAL_ERROR;
+#endif
+
+ return _server_ptrace_setup_inferior (handle);
+}
+
+static ServerCommandError
+server_ptrace_attach (ServerHandle *handle, guint32 pid)
+{
+ InferiorHandle *inferior = handle->inferior;
+
+ if (ptrace (PT_ATTACH, pid, NULL, 0) != 0) {
+ g_warning (G_STRLOC ": Can't attach to %d - %s", pid,
+ g_strerror (errno));
+ return COMMAND_ERROR_CANNOT_START_TARGET;
+ }
+
+ inferior->pid = pid;
+ inferior->is_thread = TRUE;
+
+#ifndef __MACH__
+ if (!_server_ptrace_wait_for_new_thread (handle))
+ return COMMAND_ERROR_INTERNAL_ERROR;
+#endif
+
+ return _server_ptrace_setup_inferior (handle);
+}
+
+static void
+process_output (int fd, gboolean is_stderr, ChildOutputFunc func)
+{
+ char buffer [BUFSIZ + 2];
+ int count;
+
+ count = read (fd, buffer, BUFSIZ);
+ if (count < 0)
+ return;
+
+ buffer [count] = 0;
+ func (is_stderr, buffer);
+}
+
+void
+server_ptrace_io_thread_main (IOThreadData *io_data, ChildOutputFunc func)
+{
+ struct pollfd fds [2];
+ int ret;
+
+ fds [0].fd = io_data->output_fd;
+ fds [0].events = POLLIN | POLLHUP | POLLERR;
+ fds [0].revents = 0;
+ fds [1].fd = io_data->error_fd;
+ fds [1].events = POLLIN | POLLHUP | POLLERR;
+ fds [1].revents = 0;
+
+ while (1) {
+ ret = poll (fds, 2, -1);
+
+ if ((ret < 0) && (errno != EINTR))
+ break;
+
+ if (fds [0].revents & POLLIN)
+ process_output (io_data->output_fd, FALSE, func);
+ if (fds [1].revents & POLLIN)
+ process_output (io_data->error_fd, TRUE, func);
+
+ if ((fds [0].revents & (POLLHUP | POLLERR))
+ || (fds [1].revents & (POLLHUP | POLLERR)))
+ break;
+ }
+
+ close (io_data->output_fd);
+ close (io_data->error_fd);
+ g_free (io_data);
+}
+
+static ServerCommandError
+server_ptrace_set_signal (ServerHandle *handle, guint32 sig, guint32 send_it)
+{
+ if (send_it)
+ kill (handle->inferior->pid, sig);
+ else
+ handle->inferior->last_signal = sig;
+ return COMMAND_ERROR_NONE;
+}
+
+static ServerCommandError
+server_ptrace_get_pending_signal (ServerHandle *handle, guint32 *signal)
+{
+ *signal = handle->inferior->last_signal;
+ return COMMAND_ERROR_NONE;
+}
+
+static void
+server_ptrace_set_runtime_info (ServerHandle *handle, MonoRuntimeInfo *mono_runtime)
+{
+ handle->mono_runtime = mono_runtime;
+}
+
+static guint32
+server_ptrace_get_current_pid (void)
+{
+ return getpid ();
+}
+
+static guint64
+server_ptrace_get_current_thread (void)
+{
+ return pthread_self ();
+}
+
+static gboolean initialized = FALSE;
+int pending_sigint = 0;
+
+static void
+sigint_signal_handler (int _dummy)
+{
+ pending_sigint++;
+ server_ptrace_sem_post ();
+}
+
+static void
+server_ptrace_static_init (void)
+{
+ struct sigaction sa;
+
+ if (initialized)
+ return;
+
+ /* catch SIGINT */
+ sa.sa_handler = sigint_signal_handler;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ g_assert (sigaction (SIGINT, &sa, NULL) != -1);
+
+ initialized = TRUE;
+}
+
+static int
+server_ptrace_get_pending_sigint (void)
+{
+ if (pending_sigint > 0)
+ return pending_sigint--;
+
+ return 0;
+}
+
+extern void GC_start_blocking (void);
+extern void GC_end_blocking (void);
+
+#ifdef __linux__
+#include "x86-linux-ptrace.c"
+#endif
+
+#ifdef __FreeBSD__
+#include "x86-freebsd-ptrace.c"
+#endif
+
+#ifdef __MACH__
+#include "darwin-ptrace.c"
+#endif
+
+#if defined(__i386__)
+#include "i386-arch.c"
+#elif defined(__x86_64__)
+#include "x86_64-arch.c"
+#else
+#error "Unknown architecture"
+#endif
+
+InferiorVTable i386_ptrace_inferior = {
+ server_ptrace_static_init,
+ server_ptrace_global_init,
+ server_ptrace_get_server_type,
+ server_ptrace_get_capabilities,
+ server_ptrace_create_inferior,
+ server_ptrace_initialize_process,
+ server_ptrace_initialize_thread,
+ server_ptrace_set_runtime_info,
+ server_ptrace_io_thread_main,
+ server_ptrace_spawn,
+ server_ptrace_attach,
+ server_ptrace_detach,
+ server_ptrace_finalize,
+ server_ptrace_global_wait,
+ server_ptrace_stop_and_wait,
+ server_ptrace_dispatch_event,
+ server_ptrace_dispatch_simple,
+ server_ptrace_get_target_info,
+ server_ptrace_continue,
+ server_ptrace_step,
+ server_ptrace_resume,
+ server_ptrace_get_frame,
+ server_ptrace_current_insn_is_bpt,
+ server_ptrace_peek_word,
+ server_ptrace_read_memory,
+ server_ptrace_write_memory,
+ server_ptrace_call_method,
+ server_ptrace_call_method_1,
+ server_ptrace_call_method_2,
+ server_ptrace_call_method_3,
+ server_ptrace_call_method_invoke,
+ server_ptrace_execute_instruction,
+ server_ptrace_mark_rti_frame,
+ server_ptrace_abort_invoke,
+ server_ptrace_insert_breakpoint,
+ server_ptrace_insert_hw_breakpoint,
+ server_ptrace_remove_breakpoint,
+ server_ptrace_enable_breakpoint,
+ server_ptrace_disable_breakpoint,
+ server_ptrace_get_breakpoints,
+ server_ptrace_get_registers,
+ server_ptrace_set_registers,
+ server_ptrace_stop,
+ server_ptrace_set_signal,
+ server_ptrace_get_pending_signal,
+ server_ptrace_kill,
+ server_ptrace_get_signal_info,
+ server_ptrace_get_threads,
+ server_ptrace_get_application,
+ server_ptrace_detach_after_fork,
+ server_ptrace_push_registers,
+ server_ptrace_pop_registers,
+ server_ptrace_get_callback_frame,
+ server_ptrace_restart_notification,
+ server_ptrace_get_registers_from_core_file,
+ server_ptrace_get_current_pid,
+ server_ptrace_get_current_thread,
+ server_ptrace_sem_init,
+ server_ptrace_sem_wait,
+ server_ptrace_sem_post,
+ server_ptrace_sem_get_value,
+ server_ptrace_get_pending_sigint,
+};
diff --git a/backend/server/x86-ptrace.h b/backend/server/x86-ptrace.h
new file mode 100644
index 0000000..5b901db
--- /dev/null
+++ b/backend/server/x86-ptrace.h
@@ -0,0 +1,125 @@
+#ifndef __MONO_DEBUGGER_X86_64_PTRACE_H__
+#define __MONO_DEBUGGER_X86_64_PTRACE_H__
+
+typedef struct OSData OSData;
+
+struct InferiorHandle
+{
+ OSData os;
+
+ guint32 pid;
+ int stepping;
+ int last_signal;
+ int redirect_fds;
+ int output_fd [2], error_fd [2];
+ int is_thread;
+};
+
+#ifndef PTRACE_SETOPTIONS
+#define PTRACE_SETOPTIONS 0x4200
+#endif
+#ifndef PTRACE_GETEVENTMSG
+#define PTRACE_GETEVENTMSG 0x4201
+#endif
+
+#ifndef PTRACE_EVENT_FORK
+
+/* options set using PTRACE_SETOPTIONS */
+#define PTRACE_O_TRACESYSGOOD 0x00000001
+#define PTRACE_O_TRACEFORK 0x00000002
+#define PTRACE_O_TRACEVFORK 0x00000004
+#define PTRACE_O_TRACECLONE 0x00000008
+#define PTRACE_O_TRACEEXEC 0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT 0x00000040
+
+/* Wait extended result codes for the above trace options. */
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORKDONE 5
+#define PTRACE_EVENT_EXIT 6
+
+#endif /* PTRACE_EVENT_FORK */
+
+extern int pending_sigint;
+
+static ServerCommandError
+_server_ptrace_check_errno (InferiorHandle *);
+
+static ServerCommandError
+_server_ptrace_make_memory_executable (ServerHandle *handle, guint64 start, guint32 size);
+
+static ServerCommandError
+_server_ptrace_get_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs);
+
+static ServerCommandError
+_server_ptrace_set_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs);
+
+static ServerCommandError
+_server_ptrace_get_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs);
+
+static ServerCommandError
+_server_ptrace_set_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs);
+
+static ServerCommandError
+_server_ptrace_read_memory (ServerHandle *handle, guint64 start,
+ guint32 size, gpointer buffer);
+
+static ServerCommandError
+server_ptrace_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer buffer);
+
+static ServerCommandError
+server_ptrace_write_memory (ServerHandle *handle, guint64 start,
+ guint32 size, gconstpointer buffer);
+
+static ServerCommandError
+server_ptrace_poke_word (ServerHandle *handle, guint64 addr, gsize value);
+
+static ServerCommandError
+_server_ptrace_set_dr (InferiorHandle *handle, int regnum, guint64 value);
+
+static ServerCommandError
+_server_ptrace_get_dr (InferiorHandle *handle, int regnum, guint64 *value);
+
+static ServerCommandError
+server_ptrace_continue (ServerHandle *handle);
+
+static ServerCommandError
+server_ptrace_step (ServerHandle *handle);
+
+static ServerCommandError
+server_ptrace_kill (ServerHandle *handle);
+
+static ServerCommandError
+server_ptrace_stop (ServerHandle *handle);
+
+static ServerCommandError
+server_ptrace_stop_and_wait (ServerHandle *handle, guint32 *status);
+
+static ServerCommandError
+_server_ptrace_setup_inferior (ServerHandle *handle);
+
+static void
+_server_ptrace_finalize_inferior (ServerHandle *handle);
+
+static ServerCommandError
+server_ptrace_get_signal_info (ServerHandle *handle, SignalInfo **sinfo);
+
+static gboolean
+_server_ptrace_wait_for_new_thread (ServerHandle *handle);
+
+static void
+server_ptrace_sem_init (void);
+
+static void
+server_ptrace_sem_wait (void);
+
+static void
+server_ptrace_sem_post (void);
+
+static int
+server_ptrace_sem_get_value (void);
+
+#endif
diff --git a/sysdeps/server/x86_64-arch.c b/backend/server/x86_64-arch.c
similarity index 100%
rename from sysdeps/server/x86_64-arch.c
rename to backend/server/x86_64-arch.c
diff --git a/sysdeps/server/x86_64-arch.h b/backend/server/x86_64-arch.h
similarity index 100%
rename from sysdeps/server/x86_64-arch.h
rename to backend/server/x86_64-arch.h
diff --git a/build/AssemblyInfo.cs.in b/build/AssemblyInfo.cs.in
index 41f1dfc..bbb7f4f 100644
--- a/build/AssemblyInfo.cs.in
+++ b/build/AssemblyInfo.cs.in
@@ -10,6 +10,11 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: Mono.About("Distributed under the GPL")]
+
+[assembly: Mono.Author("Martin Baulig")]
+[assembly: Mono.Author("Miguel de Icaza")]
+
[assembly: AssemblyVersion("1.0.0.0")]
namespace Mono.Debugger
diff --git a/build/Makefile.am b/build/Makefile.am
index e185050..3454bff 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -6,10 +6,6 @@ two_SCRIPTS = mdb.exe mdb-symbolreader.exe
MCS_FLAGS = -debug -define:DEBUG -define:DEBUGGER_SOURCE -nowarn:0169,0067
-if MONO_TRUNK
-MCS_FLAGS += -define:MONO_TRUNK
-endif
-
if MARTIN_PRIVATE
# Enable some more stuff for me.
if ATTACHING_SUPPORTED
@@ -53,13 +49,15 @@ MDB_SRCLIST = \
$(top_srcdir)/frontend/DebuggerTextWriter.cs \
$(top_srcdir)/frontend/Expression.cs \
$(top_srcdir)/frontend/ExpressionParser.cs \
+ $(top_srcdir)/frontend/GnuReadLine.cs \
$(top_srcdir)/frontend/Interpreter.cs \
+ $(top_srcdir)/frontend/LineReader.cs \
$(top_srcdir)/frontend/Main.cs \
+ $(top_srcdir)/frontend/ManagedReadLine.cs \
$(top_srcdir)/frontend/MyTextReader.cs \
$(top_srcdir)/frontend/ScriptingContext.cs \
$(top_srcdir)/frontend/Style.cs \
$(top_srcdir)/frontend/ObjectFormatter.cs \
- $(top_srcdir)/frontend/getline.cs \
$(LANGUAGE_SPECIFIC_FILES) \
AssemblyInfo.cs
@@ -97,6 +95,7 @@ TEST_FRAMEWORK_SRCLIST = \
AssemblyInfo.cs
TEST_FRAMEWORK_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Debugger.dll \
-r:./Mono.Debugger.Frontend.dll \
-r:System.Runtime.Remoting \
@@ -116,20 +115,25 @@ TEST_CASE_EXELIST = \
$(top_builddir)/test/src/*.dll
SYMBOL_WRITER_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Cecil.dll
SYMBOL_READER_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Cecil.dll
DEBUGGER_DEPS = \
+ -r:Mono.GetOptions \
-r:Mono.Debugger.SymbolWriter \
-r:System.Runtime.Serialization.Formatters.Soap \
-r:./Mono.Cecil.dll
MDB_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Debugger.dll
TEST_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Debugger.dll \
-r:./Mono.Debugger.Frontend.dll \
-r:./Mono.Debugger.Test.Framework.dll \
@@ -164,7 +168,7 @@ Mono.Debugger.Frontend.dll: Makefile $(MDB_SRCLIST) Mono.Debugger.dll
Mono.Debugger.Test.Framework.dll: Makefile $(TEST_FRAMEWORK_SRCLIST) Mono.Debugger.dll Mono.Debugger.Frontend.dll
$(MCS) -target:library -out:Mono.Debugger.Test.Framework.dll $(MCS_FLAGS) -keyfile:$(top_srcdir)/build/mono.snk $(TEST_FRAMEWORK_DEPS) $(TEST_FRAMEWORK_SRCLIST)
-Mono.Debugger.Test.dll: Makefile $(TEST_SRCLIST) Mono.Debugger.dll Mono.Debugger.Frontend.dll Mono.Debugger.Test.Framework.dll
+Mono.Debugger.Test.dll: Makefile $(TEST_SRCLIST) Mono.Debugger.dll Mono.Debugger.Frontend.dll
$(MCS) -target:library -out:Mono.Debugger.Test.dll $(MCS_FLAGS) -keyfile:$(top_srcdir)/build/mono.snk $(TEST_DEPS) $(TEST_SRCLIST)
Mono.Cecil.dll:
diff --git a/build/Makefile.in b/build/Makefile.in
index 4c43fc5..ea6b349 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -35,10 +35,9 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
- at MONO_TRUNK_TRUE@am__append_1 = -define:MONO_TRUNK
- at HAVE_XSP_TRUE@am__append_2 = -define:HAVE_XSP
+ at HAVE_XSP_TRUE@am__append_1 = -define:HAVE_XSP
noinst_PROGRAMS = ulimit-check$(EXEEXT)
- at MARTIN_PRIVATE_TRUE@am__append_3 = -define:MARTIN_PRIVATE
+ at MARTIN_PRIVATE_TRUE@am__append_2 = -define:MARTIN_PRIVATE
subdir = build
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/Mono.Debugger.dll.config.in
@@ -148,6 +147,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
@@ -230,8 +230,7 @@ twodir = $(prefix)/lib/mono/2.0
bin_SCRIPTS = mdb mdb-symbolreader
two_SCRIPTS = mdb.exe mdb-symbolreader.exe
MCS_FLAGS = -debug -define:DEBUG -define:DEBUGGER_SOURCE \
- -nowarn:0169,0067 $(am__append_1) $(am__append_2) \
- $(am__append_3)
+ -nowarn:0169,0067 $(am__append_1) $(am__append_2)
@ATTACHING_SUPPORTED_FALSE@@MARTIN_PRIVATE_FALSE at EXCLUDED_TESTS = NotWorking,Attach,Native,Threads,AppDomain,GUI
@ATTACHING_SUPPORTED_FALSE@@MARTIN_PRIVATE_TRUE at EXCLUDED_TESTS = NotWorking,Attach
# Exclude anything which may potentially break, only enable the
@@ -259,13 +258,15 @@ MDB_SRCLIST = \
$(top_srcdir)/frontend/DebuggerTextWriter.cs \
$(top_srcdir)/frontend/Expression.cs \
$(top_srcdir)/frontend/ExpressionParser.cs \
+ $(top_srcdir)/frontend/GnuReadLine.cs \
$(top_srcdir)/frontend/Interpreter.cs \
+ $(top_srcdir)/frontend/LineReader.cs \
$(top_srcdir)/frontend/Main.cs \
+ $(top_srcdir)/frontend/ManagedReadLine.cs \
$(top_srcdir)/frontend/MyTextReader.cs \
$(top_srcdir)/frontend/ScriptingContext.cs \
$(top_srcdir)/frontend/Style.cs \
$(top_srcdir)/frontend/ObjectFormatter.cs \
- $(top_srcdir)/frontend/getline.cs \
$(LANGUAGE_SPECIFIC_FILES) \
AssemblyInfo.cs
@@ -303,6 +304,7 @@ TEST_FRAMEWORK_SRCLIST = \
AssemblyInfo.cs
TEST_FRAMEWORK_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Debugger.dll \
-r:./Mono.Debugger.Frontend.dll \
-r:System.Runtime.Remoting \
@@ -322,20 +324,25 @@ TEST_CASE_EXELIST = \
$(top_builddir)/test/src/*.dll
SYMBOL_WRITER_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Cecil.dll
SYMBOL_READER_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Cecil.dll
DEBUGGER_DEPS = \
+ -r:Mono.GetOptions \
-r:Mono.Debugger.SymbolWriter \
-r:System.Runtime.Serialization.Formatters.Soap \
-r:./Mono.Cecil.dll
MDB_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Debugger.dll
TEST_DEPS = \
+ -r:Mono.GetOptions \
-r:./Mono.Debugger.dll \
-r:./Mono.Debugger.Frontend.dll \
-r:./Mono.Debugger.Test.Framework.dll \
@@ -683,7 +690,7 @@ Mono.Debugger.Frontend.dll: Makefile $(MDB_SRCLIST) Mono.Debugger.dll
Mono.Debugger.Test.Framework.dll: Makefile $(TEST_FRAMEWORK_SRCLIST) Mono.Debugger.dll Mono.Debugger.Frontend.dll
$(MCS) -target:library -out:Mono.Debugger.Test.Framework.dll $(MCS_FLAGS) -keyfile:$(top_srcdir)/build/mono.snk $(TEST_FRAMEWORK_DEPS) $(TEST_FRAMEWORK_SRCLIST)
-Mono.Debugger.Test.dll: Makefile $(TEST_SRCLIST) Mono.Debugger.dll Mono.Debugger.Frontend.dll Mono.Debugger.Test.Framework.dll
+Mono.Debugger.Test.dll: Makefile $(TEST_SRCLIST) Mono.Debugger.dll Mono.Debugger.Frontend.dll
$(MCS) -target:library -out:Mono.Debugger.Test.dll $(MCS_FLAGS) -keyfile:$(top_srcdir)/build/mono.snk $(TEST_DEPS) $(TEST_SRCLIST)
Mono.Cecil.dll:
diff --git a/build/mdb-symbolreader.in b/build/mdb-symbolreader.in
index 4c5262e..7138bd0 100644
--- a/build/mdb-symbolreader.in
+++ b/build/mdb-symbolreader.in
@@ -1,18 +1,3 @@
#!/bin/sh
-
-Pathclean ()
-{
- # Vulnerability fix for insecure path content
- # Make sure "::", "^:" or ":$" is not left in path arg $1
-
- local tmp
- tmp=$(echo "$1" | sed -e 's/::\+// ; s/^:// ; s/:$//' )
-
- [ "$tmp" ] && echo "$tmp"
-}
-
-LD_LIBRARY_PATH="@libdir@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-LD_LIBRARY_PATH=$(Pathclean "$LD_LIBRARY_PATH")
-export LD_LIBRARY_PATH
-
-exec @mono@ --debug @twodir@/mdb-symbolreader.exe "$@"
+export LD_LIBRARY_PATH="@libdir@:${LD_LIBRARY_PATH}"
+exec @mono@ --debug @twodir@/mdb-symbolreader.exe $*
diff --git a/build/mdb.in b/build/mdb.in
index d384617..12da6c3 100644
--- a/build/mdb.in
+++ b/build/mdb.in
@@ -1,18 +1,3 @@
#!/bin/sh
-
-Pathclean ()
-{
- # Vulnerability fix for insecure path content
- # Make sure "::", "^:" or ":$" is not left in path arg $1
-
- local tmp
- tmp=$(echo "$1" | sed -e 's/::\+// ; s/^:// ; s/:$//' )
-
- [ "$tmp" ] && echo "$tmp"
-}
-
-LD_LIBRARY_PATH="@libdir@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-LD_LIBRARY_PATH=$(Pathclean "$LD_LIBRARY_PATH")
-export LD_LIBRARY_PATH
-
-exec @mono@ --debug @twodir@/mdb.exe "$@"
+export LD_LIBRARY_PATH="@libdir@:${LD_LIBRARY_PATH}"
+exec @mono@ --debug @twodir@/mdb.exe $*
diff --git a/classes/Debugger.cs b/classes/Debugger.cs
index df6f23a..3ea2da3 100644
--- a/classes/Debugger.cs
+++ b/classes/Debugger.cs
@@ -20,41 +20,32 @@ namespace Mono.Debugger
public delegate void ThreadEventHandler (Debugger debugger, Thread thread);
public delegate void ProcessEventHandler (Debugger debugger, Process process);
- public sealed class Debugger : DebuggerMarshalByRefObject
+ public class Debugger : DebuggerMarshalByRefObject
{
+#if USE_DOMAIN
+ AppDomain domain;
+#endif
+ DebuggerServant servant;
ManualResetEvent kill_event;
- DebuggerConfiguration config;
- ThreadManager thread_manager;
- Hashtable process_hash;
- Process main_process;
- MyOperationHost operation_host;
- bool alive;
public Debugger (DebuggerConfiguration config)
{
- this.config = config;
- this.alive = true;
-
- ObjectCache.Initialize ();
-
kill_event = new ManualResetEvent (false);
- thread_manager = new ThreadManager (this);
- process_hash = Hashtable.Synchronized (new Hashtable ());
- stopped_event = new ManualResetEvent (false);
- operation_host = new MyOperationHost (this);
- }
-
- public DebuggerConfiguration Configuration {
- get { return config; }
- }
+#if USE_DOMAIN
+ domain = AppDomain.CreateDomain ("mdb");
- internal IOperationHost OperationHost {
- get { return operation_host; }
- }
+ ObjectHandle oh = domain.CreateInstance (
+ Assembly.GetExecutingAssembly ().FullName,
+ typeof (DebuggerServant).FullName, false,
+ BindingFlags.Instance | BindingFlags.NonPublic,
+ null, new object [] { this, Report.ReportWriter, config },
+ null, null, null);
- internal ThreadManager ThreadManager {
- get { return thread_manager; }
+ servant = (DebuggerServant) oh.Unwrap ();
+#else
+ servant = new DebuggerServant (this, Report.ReportWriter, config);
+#endif
}
public event ThreadEventHandler ThreadCreatedEvent;
@@ -74,6 +65,11 @@ namespace Mono.Debugger
public event ThreadEventHandler EnterNestedBreakStateEvent;
public event ThreadEventHandler LeaveNestedBreakStateEvent;
+ internal Process CreateProcess (ProcessServant servant)
+ {
+ return new Process (this, servant);
+ }
+
internal Thread CreateThread (ThreadServant servant, int id)
{
return new Thread (servant, id);
@@ -81,34 +77,22 @@ namespace Mono.Debugger
internal void OnMainProcessCreatedEvent (Process process)
{
- process_hash.Add (process, process);
if (MainProcessCreatedEvent != null)
MainProcessCreatedEvent (this, process);
}
- internal void OnProcessCreatedEvent (Process process)
- {
- process_hash.Add (process, process);
- if (ProcessCreatedEvent != null)
- ProcessCreatedEvent (this, process);
- }
-
- internal void OnProcessExitedEvent (Process process)
- {
- process_hash.Remove (process);
- if (ProcessExitedEvent != null)
- ProcessExitedEvent (this, process);
-
- if (process_hash.Count == 0)
- OnTargetExitedEvent ();
- }
-
internal void OnProcessReachedMainEvent (Process process)
{
if (ProcessReachedMainEvent != null)
ProcessReachedMainEvent (this, process);
}
+ internal void OnProcessCreatedEvent (Process process)
+ {
+ if (ProcessCreatedEvent != null)
+ ProcessCreatedEvent (this, process);
+ }
+
internal void OnTargetExitedEvent ()
{
ThreadPool.QueueUserWorkItem (delegate {
@@ -119,6 +103,12 @@ namespace Mono.Debugger
});
}
+ internal void OnProcessExitedEvent (Process process)
+ {
+ if (ProcessExitedEvent != null)
+ ProcessExitedEvent (this, process);
+ }
+
internal void OnProcessExecdEvent (Process process)
{
if (ProcessExecdEvent != null)
@@ -145,13 +135,8 @@ namespace Mono.Debugger
internal void OnTargetEvent (Thread thread, TargetEventArgs args)
{
- try {
- if (TargetEvent != null)
- TargetEvent (thread, args);
- } catch (Exception ex) {
- Error ("{0} caught exception while sending {1}:\n{2}",
- thread, args, ex);
- }
+ if (TargetEvent != null)
+ TargetEvent (thread, args);
}
internal void OnModuleLoadedEvent (Module module)
@@ -178,47 +163,18 @@ namespace Mono.Debugger
LeaveNestedBreakStateEvent (this, thread);
}
- public void Error (string message, params object[] args)
- {
- Console.WriteLine ("ERROR: " + String.Format (message, args));
- }
-
public void Kill ()
{
- if (!alive)
- return;
-
- main_process = null;
-
- Process[] procs;
- lock (process_hash.SyncRoot) {
- procs = new Process [process_hash.Count];
- process_hash.Values.CopyTo (procs, 0);
- }
-
- foreach (Process proc in procs) {
- proc.Kill ();
+ if (servant != null) {
+ servant.Kill ();
+ kill_event.WaitOne ();
}
-
- kill_event.WaitOne ();
}
public void Detach ()
{
- if (main_process == null)
- throw new TargetException (TargetError.NoTarget);
- else if (!main_process.CanDetach)
- throw new TargetException (TargetError.CannotDetach);
-
- Process[] procs;
- lock (process_hash.SyncRoot) {
- procs = new Process [process_hash.Count];
- process_hash.Values.CopyTo (procs, 0);
- }
-
- foreach (Process proc in procs) {
- proc.Detach ();
- }
+ check_servant ();
+ servant.Detach ();
}
public Process Run (DebuggerSession session)
@@ -229,14 +185,8 @@ namespace Mono.Debugger
public Process Run (DebuggerSession session, out CommandResult result)
{
- check_alive ();
-
- if (main_process != null)
- throw new TargetException (TargetError.AlreadyHaveTarget);
-
- ProcessStart start = new ProcessStart (session);
- main_process = thread_manager.StartApplication (start, out result);
- return main_process;
+ check_servant ();
+ return servant.Run (session, out result);
}
public Process Attach (DebuggerSession session, int pid)
@@ -247,170 +197,32 @@ namespace Mono.Debugger
public Process Attach (DebuggerSession session, int pid, out CommandResult result)
{
- check_alive ();
-
- if (main_process != null)
- throw new TargetException (TargetError.AlreadyHaveTarget);
-
- ProcessStart start = new ProcessStart (session, pid);
- main_process = thread_manager.StartApplication (start, out result);
- return main_process;
+ check_servant ();
+ return servant.Attach (session, pid, out result);
}
-#if DISABLED
public Process OpenCoreFile (DebuggerSession session, string core_file,
out Thread[] threads)
{
- check_alive ();
-
- if (main_process != null)
- throw new TargetException (TargetError.AlreadyHaveTarget);
-
- ProcessStart start = new ProcessStart (session, core_file);
-
- main_process = thread_manager.OpenCoreFile (start, out threads);
- process_hash.Add (main_process, main_process);
- return main_process;
+ check_servant ();
+ return servant.OpenCoreFile (session, core_file, out threads);
}
-#endif
public bool HasTarget {
- get { return alive; }
+ get { return servant != null; }
}
public Process[] Processes {
get {
- check_alive ();
- lock (process_hash.SyncRoot) {
- int count = process_hash.Count;
- Process[] procs = new Process [count];
- Process[] servants = new Process [count];
- process_hash.Values.CopyTo (servants, 0);
- for (int i = 0; i < count; i++)
- procs [i] = servants [i];
- return procs;
- }
+ check_servant ();
+ return servant.Processes;
}
}
public bool CanDetach {
- get {
- return alive && (main_process != null) && main_process.CanDetach;
- }
- }
-
-#region Global Threading Model
-
- ManualResetEvent stopped_event;
- OperationCommandResult current_operation;
-
- internal WaitHandle WaitHandle {
- get { return stopped_event; }
+ get { return (servant != null) && servant.CanDetach; }
}
- internal CommandResult StartOperation (ThreadingModel model, SingleSteppingEngine caller)
- {
- if (!ThreadManager.InBackgroundThread)
- throw new InternalError ();
-
- if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Default) {
- if (Inferior.HasThreadEvents)
- model |= ThreadingModel.Single;
- else
- model |= ThreadingModel.Process;
- }
-
- if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Global)
- return caller.Process.StartOperation (model, caller);
-
- if (current_operation != null)
- throw new TargetException (TargetError.NotStopped);
-
- lock (this) {
- stopped_event.Reset ();
- current_operation = new GlobalCommandResult (this, model);
- }
-
- foreach (Process process in process_hash.Values) {
- process.StartGlobalOperation (model, caller, current_operation);
- }
-
- return current_operation;
- }
-
- void OperationCompleted (SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
- {
- if (!ThreadManager.InBackgroundThread)
- throw new InternalError ();
-
- foreach (Process process in process_hash.Values) {
- process.OperationCompleted (caller, result, model);
- }
-
- lock (this) {
- current_operation = null;
- stopped_event.Set ();
- }
- }
-
- void StopAll ()
- {
- foreach (Process process in process_hash.Values) {
- process.Stop ();
- }
- }
-
- class MyOperationHost : IOperationHost
- {
- public Debugger Debugger;
-
- public MyOperationHost (Debugger debugger)
- {
- this.Debugger = debugger;
- }
-
- void IOperationHost.OperationCompleted (SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
- {
- Debugger.OperationCompleted (caller, result, model);
- }
-
- WaitHandle IOperationHost.WaitHandle {
- get { return Debugger.stopped_event; }
- }
-
- void IOperationHost.SendResult (SingleSteppingEngine sse, TargetEventArgs args)
- {
- Debugger.OnTargetEvent (sse.Thread, args);
- }
-
- void IOperationHost.Abort ()
- {
- Debugger.StopAll ();
- }
- }
-
- class GlobalCommandResult : OperationCommandResult
- {
- public Debugger Debugger {
- get; private set;
- }
-
- internal override IOperationHost Host {
- get { return Debugger.OperationHost; }
- }
-
- internal GlobalCommandResult (Debugger debugger, ThreadingModel model)
- : base (model)
- {
- this.Debugger = debugger;
- }
-
- internal override void OnExecd (SingleSteppingEngine new_thread)
- { }
- }
-
-#endregion
-
[Obsolete]
GUIManager gui_manager;
@@ -428,9 +240,9 @@ namespace Mono.Debugger
// IDisposable
//
- void check_alive ()
+ void check_servant ()
{
- if (!alive)
+ if (servant == null)
throw new TargetException (TargetError.NoTarget);
}
@@ -442,7 +254,7 @@ namespace Mono.Debugger
throw new ObjectDisposedException ("DebuggerServant");
}
- void Dispose (bool disposing)
+ protected virtual void Dispose (bool disposing)
{
// Check to see if Dispose has already been called.
lock (this) {
@@ -450,17 +262,21 @@ namespace Mono.Debugger
return;
disposed = true;
- alive = false;
}
// If this is a call to Dispose, dispose all managed resources.
if (disposing) {
- if (thread_manager != null) {
- thread_manager.Dispose ();
- thread_manager = null;
+ if (servant != null) {
+ servant.Dispose ();
+ servant = null;
}
- ObjectCache.Shutdown ();
+#if USE_DOMAIN
+ if (domain != null) {
+ AppDomain.Unload (domain);
+ domain = null;
+ }
+#endif
}
}
diff --git a/classes/ExpressionEvaluator.cs b/classes/ExpressionEvaluator.cs
index ceb3f96..3b693c5 100644
--- a/classes/ExpressionEvaluator.cs
+++ b/classes/ExpressionEvaluator.cs
@@ -91,9 +91,6 @@ namespace Mono.Debugger
{
result = null;
- if (!obj.Type.Language.IsManaged)
- return EvaluationResult.MethodNotFound;
-
again:
TargetStructType ctype = obj.Type;
if ((ctype.Name == "System.Object") || (ctype.Name == "System.ValueType"))
@@ -160,11 +157,9 @@ namespace Mono.Debugger
return EvaluationResult.Ok;
}
- if (obj.Type.HasParent) {
- obj = obj.GetParentObject (thread) as TargetClassObject;
- if (obj != null)
- goto again;
- }
+ obj = obj.GetParentObject (thread) as TargetClassObject;
+ if (obj != null)
+ goto again;
return EvaluationResult.MethodNotFound;
}
diff --git a/classes/MainMethodBreakpoint.cs b/classes/MainMethodBreakpoint.cs
index 8a31cfd..8216f00 100644
--- a/classes/MainMethodBreakpoint.cs
+++ b/classes/MainMethodBreakpoint.cs
@@ -32,14 +32,14 @@ namespace Mono.Debugger
return handle;
if (frame.Thread.Process.IsManaged) {
- MonoLanguageBackend mono = frame.Thread.Process.MonoLanguage;
+ MonoLanguageBackend mono = frame.Thread.Process.Servant.MonoLanguage;
MonoFunctionType main = mono.MainMethod;
if (main == null)
return null;
handle = main.GetBreakpointHandle (this, -1, -1);
} else {
- OperatingSystemBackend os = frame.Thread.Process.OperatingSystem;
+ OperatingSystemBackend os = frame.Thread.Process.Servant.OperatingSystem;
TargetAddress main = os.LookupSymbol ("main");
if (main.IsNull)
return null;
diff --git a/classes/Makefile.in b/classes/Makefile.in
index 395474f..c17586b 100644
--- a/classes/Makefile.in
+++ b/classes/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/classes/Method.cs b/classes/Method.cs
index 8d18d6c..b0eebfa 100644
--- a/classes/Method.cs
+++ b/classes/Method.cs
@@ -173,9 +173,6 @@ namespace Mono.Debugger
get {
return name;
}
- protected set {
- name = value;
- }
}
public string ImageFile {
diff --git a/classes/Process.cs b/classes/Process.cs
index a4bf08e..e9cd19e 100644
--- a/classes/Process.cs
+++ b/classes/Process.cs
@@ -7,11 +7,8 @@ using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using Mono.Debugger.Backend;
-using Mono.Debugger.Backend.Mono;
-using Mono.Debugger.Architectures;
using Mono.Debugger.Languages;
using Mono.Debugger.Languages.Mono;
-using Mono.Debugger.Languages.Native;
namespace Mono.Debugger
{
@@ -25,17 +22,96 @@ namespace Mono.Debugger
StopUnhandled = 2
}
- public sealed class Process : DebuggerMarshalByRefObject
+ public class Process : DebuggerMarshalByRefObject
{
+ Debugger debugger;
+ ProcessServant servant;
+
int id = ++next_id;
static int next_id = 0;
+ internal Process (Debugger debugger, ProcessServant servant)
+ {
+ this.debugger = debugger;
+ this.servant = servant;
+ }
+
public int ID {
get { return id; }
}
+ public Debugger Debugger {
+ get { return debugger; }
+ }
+
+ public DebuggerSession Session {
+ get { return servant.Session; }
+ }
+
+ internal ProcessServant Servant {
+ get { return servant; }
+ }
+
+ internal ProcessStart ProcessStart {
+ get { return servant.ProcessStart; }
+ }
+
public Thread MainThread {
- get { return MainThreadServant.Client; }
+ get { return servant.MainThread.Client; }
+ }
+
+ public bool IsManaged {
+ get { return servant.IsManaged; }
+ }
+
+ public string TargetApplication {
+ get { return servant.TargetApplication; }
+ }
+
+ public string[] CommandLineArguments {
+ get { return servant.CommandLineArguments; }
+ }
+
+ public Language NativeLanguage {
+ get { return servant.NativeLanguage; }
+ }
+
+ public ST.WaitHandle WaitHandle {
+ get { return servant.WaitHandle; }
+ }
+
+ public void Kill ()
+ {
+ servant.Kill ();
+ }
+
+ public void Detach ()
+ {
+ servant.Detach ();
+ }
+
+ public void LoadLibrary (Thread thread, string filename)
+ {
+ servant.LoadLibrary (thread, filename);
+ }
+
+ public Module[] Modules {
+ get { return servant.Modules; }
+ }
+
+ public Method Lookup (TargetAddress address)
+ {
+ return servant.SymbolTableManager.Lookup (address);
+ }
+
+ public TargetAddress LookupSymbol (string name)
+ {
+ return servant.LookupSymbol (name);
+ }
+
+ public Thread[] GetThreads ()
+ {
+ return servant.GetThreads ();
}
public override string ToString ()
@@ -56,19 +132,19 @@ namespace Mono.Debugger
if (!Session.HasPendingBreakpoints ())
return null;
- BreakpointCommandResult result = new BreakpointCommandResult (this);
- bool completed = ActivatePendingBreakpoints_internal (result);
+ ProcessCommandResult result = new ProcessCommandResult (this);
+ bool completed = servant.ActivatePendingBreakpoints (result);
if (completed)
return null;
return result;
}
- class BreakpointCommandResult : CommandResult
+ protected class ProcessCommandResult : CommandResult
{
Process process;
ST.ManualResetEvent completed_event = new ST.ManualResetEvent (false);
- internal BreakpointCommandResult (Process process)
+ internal ProcessCommandResult (Process process)
{
this.process = process;
}
@@ -148,910 +224,6 @@ namespace Mono.Debugger
check_disposed ();
}
- TargetInfo target_info;
- ThreadManager manager;
- Architecture architecture;
- OperatingSystemBackend os;
- NativeLanguage native_language;
- SymbolTableManager symtab_manager;
- MonoThreadManager mono_manager;
- BreakpointManager breakpoint_manager;
- Dictionary<int,ExceptionCatchPoint> exception_handlers;
- ProcessStart start;
- DebuggerSession session;
- MonoLanguageBackend mono_language;
- ThreadServant main_thread;
- Hashtable thread_hash;
-
- MyOperationHost operation_host;
-
- Process parent;
-
- ThreadDB thread_db;
-
- bool is_attached;
- bool is_execed;
- bool is_forked;
- bool initialized;
- DebuggerMutex thread_lock_mutex;
- bool has_thread_lock;
-
- private Process (ThreadManager manager, DebuggerSession session)
- {
- this.manager = manager;
- this.session = session;
-
- operation_host = new MyOperationHost (this);
-
- thread_lock_mutex = new DebuggerMutex ("thread_lock_mutex");
-
- stopped_event = new ST.ManualResetEvent (false);
-
- thread_hash = Hashtable.Synchronized (new Hashtable ());
-
- target_info = Inferior.GetTargetInfo ();
- if (target_info.TargetAddressSize == 8)
- architecture = new Architecture_X86_64 (this, target_info);
- else
- architecture = new Architecture_I386 (this, target_info);
- }
-
- internal Process (ThreadManager manager, ProcessStart start)
- : this (manager, start.Session)
- {
- this.start = start;
-
- is_attached = start.PID != 0;
-
- breakpoint_manager = new BreakpointManager ();
-
- exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
-
- symtab_manager = new SymbolTableManager (session);
-
- os = Inferior.CreateOperatingSystemBackend (this);
- native_language = new NativeLanguage (this, os, target_info);
-
- session.OnProcessCreated (this);
- }
-
- private Process (Process parent, int pid)
- : this (parent.manager, parent.session)
- {
- this.start = new ProcessStart (parent.ProcessStart, pid);
-
- this.is_forked = true;
- this.initialized = true;
-
- this.parent = parent;
-
- breakpoint_manager = new BreakpointManager (parent.breakpoint_manager);
-
- exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
- foreach (KeyValuePair<int,ExceptionCatchPoint> catchpoint in parent.exception_handlers)
- exception_handlers.Add (catchpoint.Key, catchpoint.Value);
-
- symtab_manager = parent.symtab_manager;
-
- native_language = parent.native_language;
- os = parent.os;
- }
-
- public Debugger Debugger {
- get { return manager.Debugger; }
- }
-
- public bool IsAttached {
- get { return is_attached; }
- }
-
- public bool CanDetach {
- get { return is_attached || Inferior.CanDetachAny; }
- }
-
- public bool IsExeced {
- get { return is_execed; }
- }
-
- public DebuggerSession Session {
- get { return session; }
- }
-
- internal ThreadManager ThreadManager {
- get { return manager; }
- }
-
- internal Architecture Architecture {
- get { return architecture; }
- }
-
- internal BreakpointManager BreakpointManager {
- get { return breakpoint_manager; }
- }
-
- internal SymbolTableManager SymbolTableManager {
- get {
- return symtab_manager;
- }
- }
-
- public Language NativeLanguage {
- get { return native_language; }
- }
-
- internal OperatingSystemBackend OperatingSystem {
- get { return os; }
- }
-
- internal ThreadServant MainThreadServant {
- get { return main_thread; }
- }
-
- internal ProcessStart ProcessStart {
- get { return start; }
- }
-
- internal MonoThreadManager MonoManager {
- get { return mono_manager; }
- }
-
- internal bool MonoRuntimeFound {
- get; private set;
- }
-
- public bool IsManaged {
- get { return mono_manager != null; }
- }
-
- internal bool CanExecuteCode {
- get { return (mono_manager != null) && mono_manager.CanExecuteCode; }
- }
-
- public string TargetApplication {
- get { return start.TargetApplication; }
- }
-
- public string[] CommandLineArguments {
- get { return start.CommandLineArguments; }
- }
-
- internal ST.WaitHandle WaitHandle {
- get { return stopped_event; }
- }
-
- internal IOperationHost OperationHost {
- get { return operation_host; }
- }
-
- internal void ThreadCreated (Inferior inferior, int pid, bool do_attach, bool resume_thread)
- {
- Inferior new_inferior = inferior.CreateThread (pid, do_attach);
-
- SingleSteppingEngine new_thread = new SingleSteppingEngine (manager, this, new_inferior, pid);
-
- Report.Debug (DebugFlags.Threads, "Thread created: {0} {1} {2}", pid, new_thread, do_attach);
-
- if (mono_manager != null)
- mono_manager.ThreadCreated (new_thread);
-
- if (!do_attach && !is_execed)
- get_thread_info (inferior, new_thread);
- OnThreadCreatedEvent (new_thread);
-
- if (resume_thread) {
- CommandResult result = current_operation != null ?
- current_operation : new ThreadCommandResult (new_thread.Thread);
- new_thread.StartThread (result);
- } else {
- new_thread.StartSuspended ();
- }
- }
-
- internal void ChildForked (Inferior inferior, int pid)
- {
- Process new_process = new Process (this, pid);
- new_process.ProcessStart.StopInMain = false;
-
- Inferior new_inferior = Inferior.CreateInferior (
- manager, new_process, new_process.ProcessStart);
- new_inferior.InitializeThread (pid);
-
- if (!manager.Debugger.Configuration.FollowFork) {
- new_inferior.DetachAfterFork ();
- return;
- }
-
- SingleSteppingEngine new_thread = new SingleSteppingEngine (
- manager, new_process, new_inferior, pid);
-
- Report.Debug (DebugFlags.Threads, "Child forked: {0} {1}", pid, new_thread);
-
- new_process.main_thread = new_thread;
-
- manager.Debugger.OnProcessCreatedEvent (new_process);
- new_process.OnThreadCreatedEvent (new_thread);
-
- CommandResult result = new_process.CloneParentOperation (new_thread);
- new_thread.StartForkedChild (result);
- }
-
- internal void ChildExecd (SingleSteppingEngine engine, Inferior inferior)
- {
- is_execed = true;
-
- if (!is_forked) {
- if (mono_language != null)
- mono_language.Dispose();
-
- if (native_language != null)
- native_language.Dispose ();
-
- if (os != null)
- os.Dispose ();
-
- if (symtab_manager != null)
- symtab_manager.Dispose ();
- }
-
- if (breakpoint_manager != null)
- breakpoint_manager.Dispose ();
-
- session.OnProcessExecd (this);
-
- breakpoint_manager = new BreakpointManager ();
-
- exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
-
- symtab_manager = new SymbolTableManager (session);
-
- os = Inferior.CreateOperatingSystemBackend (this);
- native_language = new NativeLanguage (this, os, target_info);
-
- Inferior new_inferior = Inferior.CreateInferior (manager, this, start);
- try {
- new_inferior.InitializeAfterExec (inferior.PID);
- } catch (Exception ex) {
- if ((ex is TargetException) && (((TargetException) ex).Type == TargetError.PermissionDenied)) {
- Report.Error ("Permission denied when trying to debug exec()ed child {0}, detaching!",
- inferior.PID);
- } else {
- Report.Error ("InitializeAfterExec() failed on pid {0}: {1}", inferior.PID, ex);
- }
- new_inferior.DetachAfterFork ();
- return;
- }
-
- SingleSteppingEngine new_thread = new SingleSteppingEngine (
- manager, this, new_inferior, inferior.PID);
-
- ThreadServant[] threads;
- lock (thread_hash.SyncRoot) {
- threads = new ThreadServant [thread_hash.Count];
- thread_hash.Values.CopyTo (threads, 0);
- }
-
- for (int i = 0; i < threads.Length; i++) {
- if (threads [i].PID != inferior.PID)
- threads [i].Kill ();
- }
-
- thread_hash [inferior.PID] = new_thread;
-
- inferior.Dispose ();
- inferior = null;
-
- manager.Debugger.OnProcessExecdEvent (this);
- manager.Debugger.OnThreadCreatedEvent (new_thread.Thread);
- initialized = is_forked = false;
- main_thread = new_thread;
-
- if ((engine.Thread.ThreadFlags & Thread.Flags.StopOnExit) != 0)
- new_thread.Thread.ThreadFlags |= Thread.Flags.StopOnExit;
-
- CommandResult result = engine.OnExecd (new_thread);
- new_thread.StartExecedChild (result);
- }
-
- internal CommandResult StartApplication ()
- {
- SingleSteppingEngine engine = new SingleSteppingEngine (manager, this, start);
-
- initialized = true;
-
- this.main_thread = engine;
- engine.Thread.ThreadFlags |= Thread.Flags.StopOnExit;
-
- if (thread_hash.Contains (engine.PID))
- thread_hash [engine.PID] = engine;
- else
- thread_hash.Add (engine.PID, engine);
- session.MainThreadGroup.AddThread (engine.Thread.ID);
-
- session.OnMainProcessCreated (this);
- manager.Debugger.OnMainProcessCreatedEvent (this);
-
- CommandResult result = Debugger.StartOperation (start.Session.Config.ThreadingModel, engine);
- return engine.StartApplication (result);
- }
-
- internal void OnProcessExitedEvent ()
- {
- DropGlobalThreadLock ();
-
- if (current_state == ProcessState.Running) {
- current_state = ProcessState.Exited;
- current_operation.Completed ();
- current_operation = null;
- stopped_event.Set ();
- }
-
- if (!is_forked)
- session.OnProcessExited (this);
- session.MainThreadGroup.RemoveThread (main_thread.ID);
- manager.Debugger.OnProcessExitedEvent (this);
- }
-
- void OnThreadCreatedEvent (ThreadServant thread)
- {
- thread_hash.Add (thread.PID, thread);
- manager.Debugger.OnThreadCreatedEvent (thread.Client);
- }
-
- internal void OnManagedThreadExitedEvent (ThreadServant thread)
- {
- thread_hash.Remove (thread.PID);
- }
-
- internal void OnProcessReachedMainEvent ()
- {
- manager.Debugger.OnProcessReachedMainEvent (this);
- }
-
- internal void OnThreadExitedEvent (ThreadServant thread)
- {
- thread_hash.Remove (thread.PID);
- thread.ThreadGroup.RemoveThread (thread.ID);
- session.DeleteThreadGroup (thread.ThreadGroup.Name);
- manager.Debugger.OnThreadExitedEvent (thread.Client);
-
- if (thread_hash.Count == 0)
- OnProcessExitedEvent ();
- }
-
- internal void InitializeMono (Inferior inferior, TargetAddress mdb_debug_info)
- {
- MonoRuntimeFound = true;
- mono_manager = MonoThreadManager.Initialize (this, inferior, mdb_debug_info, is_attached);
-
- InitializeThreads (inferior, !is_attached);
-
- if (mono_manager == null)
- return;
-
- mono_manager.InitializeThreads (inferior);
-
- if (is_attached)
- mono_manager.InitializeAfterAttach (inferior);
- }
-
- internal void InitializeThreads (Inferior inferior, bool resume_threads)
- {
- if (thread_db != null)
- return;
-
- thread_db = ThreadDB.Create (this, inferior);
- if (thread_db == null) {
- if (!IsManaged)
- return;
-
- Report.Error ("Failed to initialize thread_db on {0}", start.CommandLine);
- throw new TargetException (TargetError.CannotStartTarget,
- "Failed to initialize thread_db on {0}", start.CommandLine);
- }
-
- int[] threads = inferior.GetThreads ();
- foreach (int thread in threads) {
- if (thread_hash.Contains (thread))
- continue;
- ThreadCreated (inferior, thread, Inferior.HasThreadEvents, resume_threads);
- }
-
- thread_db.GetThreadInfo (inferior, delegate (int lwp, long tid) {
- SingleSteppingEngine engine = (SingleSteppingEngine) thread_hash [lwp];
- if (engine == null) {
- Report.Error ("Unknown thread {0} in {1}", lwp, start.CommandLine);
- return;
- }
- engine.SetTID (tid);
- });
- }
-
- internal bool CheckForThreads (ArrayList check_threads)
- {
- if(thread_db == null)
- return false;
- thread_db.GetThreadInfo (null, delegate (int lwp, long tid) {
- check_threads.Add(lwp);
- } );
- return true;
- }
-
- void get_thread_info (Inferior inferior, SingleSteppingEngine engine)
- {
- if (thread_db == null) {
- if (mono_manager == null)
- return;
- Report.Error ("Failed to initialize thread_db on {0}: {1} {2}",
- start.CommandLine, start, Environment.StackTrace);
- throw new InternalError ();
- }
-
- bool found = false;
- thread_db.GetThreadInfo (inferior, delegate (int lwp, long tid) {
- if (lwp != engine.PID)
- return;
-
- engine.SetTID (tid);
- found = true;
- });
-
- if (!found)
- Report.Error ("Cannot find thread {0:x} in {1}",
- engine.PID, start.CommandLine);
- }
-
- internal SingleSteppingEngine GetEngineByTID (Inferior inferior, long tid)
- {
- foreach (SingleSteppingEngine engine in thread_hash.Values) {
- if (engine.TID == tid)
- return engine;
- }
-
- if (thread_db == null) {
- Report.Error ("Failed to initialize thread_db on {0}: {1}",
- start.CommandLine, start);
- return null;
- }
-
- SingleSteppingEngine result = null;
- thread_db.GetThreadInfo (inferior, delegate (int t_lwp, long t_tid) {
- if (tid != t_tid)
- return;
- result = (SingleSteppingEngine) thread_hash [t_lwp];
-
- });
-
- if (result == null)
- Report.Error ("Cannot find thread {0:x} in {1}",
- tid, start.CommandLine);
-
- return result;
- }
-
- public void Kill ()
- {
- if (!Inferior.HasThreadEvents) {
- SingleSteppingEngine[] sses = new SingleSteppingEngine [thread_hash.Count];
- thread_hash.Values.CopyTo (sses, 0);
- foreach (SingleSteppingEngine sse in sses)
- sse.SetKilledFlag ();
- foreach (SingleSteppingEngine sse in sses)
- sse.Kill ();
- } else {
- main_thread.Kill ();
- }
- }
-
- public void Detach ()
- {
- if (!CanDetach)
- throw new TargetException (TargetError.CannotDetach);
-
- main_thread.Detach ();
- }
-
- internal void OnTargetDetached ()
- {
- OnProcessExitedEvent ();
- Dispose ();
- }
-
- internal MonoLanguageBackend CreateMonoLanguage (MonoDebuggerInfo info)
- {
- mono_language = new MonoLanguageBackend (this, info);
- return mono_language;
- }
-
- internal void UpdateSymbolTable (TargetMemoryAccess target)
- {
- if (mono_language != null)
- mono_language.Update (target);
- }
-
- public void LoadLibrary (Thread thread, string filename)
- {
- if (mono_language == null)
- throw new SymbolTableException (
- "Cannot load .NET assembly `{0}' while " +
- "debugging an unmanaged application.",
- filename);
-
- if (!mono_language.TryFindImage (thread, filename))
- throw new SymbolTableException ("Could not find any .NET assembly `{0}'.", filename);
- }
-
- internal MonoLanguageBackend MonoLanguage {
- get {
- if (mono_language == null)
- throw new InvalidOperationException ();
-
- return mono_language;
- }
- }
-
- internal bool IsManagedApplication {
- get { return mono_language != null; }
- }
-
- public Module[] Modules {
- get { return session.Modules; }
- }
-
- public SourceLocation FindLocation (string file, int line)
- {
- foreach (Module module in Modules) {
- SourceLocation location = module.FindLocation (file, line);
-
- if (location != null)
- return location;
- }
-
- return null;
- }
-
- public SourceLocation FindMethod (string name)
- {
- foreach (Module module in Modules) {
- MethodSource method = module.FindMethod (name);
-
- if (method != null)
- return new SourceLocation (method);
- }
-
- return null;
- }
-
- internal ThreadServant[] ThreadServants {
- get {
- lock (thread_hash.SyncRoot) {
- int count = thread_hash.Count;
- ThreadServant[] servants = new ThreadServant [count];
- thread_hash.Values.CopyTo (servants, 0);
- return servants;
- }
- }
- }
-
- internal SingleSteppingEngine[] Engines {
- get {
- lock (thread_hash.SyncRoot) {
- int count = thread_hash.Count;
- SingleSteppingEngine[] engines = new SingleSteppingEngine [count];
- thread_hash.Values.CopyTo (engines, 0);
- return engines;
- }
- }
- }
-
- public TargetAddress LookupSymbol (string name)
- {
- return os.LookupSymbol (name);
- }
-
- public Thread[] GetThreads ()
- {
- lock (thread_hash.SyncRoot) {
- int count = thread_hash.Count;
- Thread[] threads = new Thread [count];
- ThreadServant[] servants = new ThreadServant [count];
- thread_hash.Values.CopyTo (servants, 0);
- for (int i = 0; i < count; i++)
- threads [i] = servants [i].Client;
- return threads;
- }
- }
-
- internal bool HasThreadLock {
- get { return has_thread_lock; }
- }
-
- // <summary>
- // Stop all currently running threads without sending any notifications.
- // The threads are automatically resumed to their previos state when
- // ReleaseGlobalThreadLock() is called.
- // </summary>
- internal void AcquireGlobalThreadLock (SingleSteppingEngine caller)
- {
- if (has_thread_lock)
- throw new InternalError ("Recursive thread lock");
-
- thread_lock_mutex.Lock ();
- Report.Debug (DebugFlags.Threads,
- "Acquiring global thread lock: {0}", caller);
- has_thread_lock = true;
- foreach (ThreadServant thread in thread_hash.Values) {
- if (thread == caller)
- continue;
- thread.AcquireThreadLock ();
- }
- Report.Debug (DebugFlags.Threads,
- "Done acquiring global thread lock: {0}",
- caller);
- }
-
- internal void ReleaseGlobalThreadLock (SingleSteppingEngine caller)
- {
- Report.Debug (DebugFlags.Threads,
- "Releasing global thread lock: {0}", caller);
-
- foreach (ThreadServant thread in thread_hash.Values) {
- if (thread == caller)
- continue;
- thread.ReleaseThreadLock ();
- }
- has_thread_lock = false;
- thread_lock_mutex.Unlock ();
- Report.Debug (DebugFlags.Threads,
- "Released global thread lock: {0}", caller);
- }
-
- internal void DropGlobalThreadLock ()
- {
- if (thread_hash.Count != 0)
- throw new InternalError ();
-
- if (has_thread_lock) {
- has_thread_lock = false;
- thread_lock_mutex.Unlock ();
- }
- }
-
-#region User Threads
-
- internal enum ProcessState
- {
- SingleThreaded,
- Running,
- Stopping,
- Stopped,
- Exited
- }
-
- ST.ManualResetEvent stopped_event;
-
- ProcessState current_state = ProcessState.Stopped;
- OperationCommandResult current_operation = null;
-
- internal void OperationCompleted (SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
- {
- if (!ThreadManager.InBackgroundThread && Inferior.HasThreadEvents)
- throw new InternalError ();
-
- if (current_state == ProcessState.Stopping)
- return;
- else if (current_state != ProcessState.Running)
- throw new InternalError ();
-
- if ((result != null) && (caller != main_thread) &&
- ((result.Type == TargetEventType.TargetExited) || (result.Type == TargetEventType.TargetSignaled)))
- return;
-
- current_state = ProcessState.Stopping;
- SuspendUserThreads (model, caller);
-
- lock (this) {
- current_state = ProcessState.Stopped;
- current_operation.Completed ();
- current_operation = null;
- stopped_event.Set ();
- }
- }
-
- void SuspendUserThreads (ThreadingModel model, SingleSteppingEngine caller)
- {
- Report.Debug (DebugFlags.Threads,
- "Suspending user threads: {0} {1}", model, caller);
-
- foreach (SingleSteppingEngine engine in thread_hash.Values) {
- Report.Debug (DebugFlags.Threads, " check user thread: {0} {1}",
- engine, engine.Thread.ThreadFlags);
- if (engine == caller)
- continue;
- if (((engine.Thread.ThreadFlags & Thread.Flags.Immutable) != 0) &&
- ((model & ThreadingModel.StopImmutableThreads) == 0))
- continue;
- if (((engine.Thread.ThreadFlags & Thread.Flags.Daemon) != 0) &&
- ((model & ThreadingModel.StopDaemonThreads) == 0))
- continue;
- engine.SuspendUserThread ();
- }
-
- Report.Debug (DebugFlags.Threads,
- "Done suspending user threads: {0} {1}", model, caller);
- }
-
- void ResumeUserThreads (ThreadingModel model, SingleSteppingEngine caller)
- {
- Report.Debug (DebugFlags.Threads,
- "Resuming user threads: {0}", caller);
-
- foreach (SingleSteppingEngine engine in thread_hash.Values) {
- if (engine == caller)
- continue;
- if ((engine.Thread.ThreadFlags & Thread.Flags.AutoRun) == 0)
- continue;
- if (((engine.Thread.ThreadFlags & Thread.Flags.Immutable) != 0) &&
- ((model & ThreadingModel.StopImmutableThreads) == 0))
- continue;
- if (((engine.Thread.ThreadFlags & Thread.Flags.Daemon) != 0) &&
- ((model & ThreadingModel.StopDaemonThreads) == 0))
- continue;
-
- CommandResult result;
- if (current_operation != null)
- result = current_operation;
- else
- result = new ThreadCommandResult (engine.Thread);
-
- engine.ResumeUserThread (result);
- }
-
- Report.Debug (DebugFlags.Threads,
- "Resumed user threads: {0}", caller);
- }
-
- internal CommandResult StartOperation (ThreadingModel model, SingleSteppingEngine caller)
- {
- if (!ThreadManager.InBackgroundThread)
- throw new InternalError ();
-
- if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
- throw new TargetException (TargetError.NotStopped);
-
- if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Single) {
- current_state = ProcessState.SingleThreaded;
- if ((model & ThreadingModel.ResumeThreads) != 0)
- ResumeUserThreads (model, caller);
- return new ThreadCommandResult (caller.Thread);
- } else if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Process) {
- throw new ArgumentException ();
- }
-
- lock (this) {
- current_state = ProcessState.Running;
- stopped_event.Reset ();
- current_operation = new ProcessCommandResult (this, model);
- }
-
- ResumeUserThreads (model, caller);
- return current_operation;
- }
-
- internal void StartGlobalOperation (ThreadingModel model, SingleSteppingEngine caller, OperationCommandResult operation)
- {
- if (!ThreadManager.InBackgroundThread)
- throw new InternalError ();
-
- if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
- throw new TargetException (TargetError.NotStopped);
-
- lock (this) {
- current_state = ProcessState.Running;
- stopped_event.Reset ();
- current_operation = operation;
- }
-
- ResumeUserThreads (model, caller);
- }
-
- CommandResult CloneParentOperation (SingleSteppingEngine new_thread)
- {
- if (parent.current_state == ProcessState.SingleThreaded) {
- current_state = ProcessState.SingleThreaded;
- return new ThreadCommandResult (new_thread.Thread);
- }
-
- if (parent.current_state != ProcessState.Running)
- throw new InternalError ();
-
- current_state = ProcessState.Running;
- if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Global)
- current_operation = parent.current_operation;
- else if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Process)
- current_operation = new ProcessCommandResult (this, parent.current_operation.ThreadingModel);
- else
- throw new InternalError ();
-
- return current_operation;
- }
-
- internal void Stop ()
- {
- main_thread.Invoke (delegate {
- current_state = ProcessState.Stopping;
-
- SuspendUserThreads (ThreadingModel.Process, null);
- current_state = ProcessState.Stopped;
- if (current_operation != null) {
- current_operation.Completed ();
- current_operation = null;
- }
- stopped_event.Set ();
- return null;
- }, null);
- }
-
- class MyOperationHost : IOperationHost
- {
- public Process Process;
-
- public MyOperationHost (Process process)
- {
- this.Process = process;
- }
-
- void IOperationHost.OperationCompleted (SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
- {
- Process.OperationCompleted (caller, result, model);
- }
-
- ST.WaitHandle IOperationHost.WaitHandle {
- get { return Process.stopped_event; }
- }
-
- void IOperationHost.SendResult (SingleSteppingEngine sse, TargetEventArgs args)
- {
- Process.Debugger.OnTargetEvent (sse.Client, args);
- }
-
- void IOperationHost.Abort ()
- {
- Process.Stop ();
- }
- }
-
- class ProcessCommandResult : OperationCommandResult
- {
- public Process Process {
- get; private set;
- }
-
- internal override IOperationHost Host {
- get { return Process.OperationHost; }
- }
-
- internal ProcessCommandResult (Process process, ThreadingModel model)
- : base (model)
- {
- this.Process = process;
- }
-
- internal override void OnExecd (SingleSteppingEngine new_thread)
- {
- Process = new_thread.Process;
- }
- }
-
-#endregion
-
- internal bool ActivatePendingBreakpoints_internal (CommandResult result)
- {
- return ((SingleSteppingEngine) main_thread).ManagedCallback (
- delegate (SingleSteppingEngine sse) {
- return sse.ActivatePendingBreakpoints (null);
- }, result);
- }
-
//
// IDisposable
//
@@ -1064,55 +236,6 @@ namespace Mono.Debugger
throw new ObjectDisposedException ("Process");
}
- void DoDispose ()
- {
- if (!is_forked) {
- if (architecture != null) {
- architecture.Dispose ();
- architecture = null;
- }
-
- if (mono_language != null) {
- mono_language.Dispose();
- mono_language = null;
- }
-
- if (native_language != null) {
- native_language.Dispose ();
- native_language = null;
- }
-
- if (os != null) {
- os.Dispose ();
- os = null;
- }
-
- if (symtab_manager != null) {
- symtab_manager.Dispose ();
- symtab_manager = null;
- }
- }
-
- if (breakpoint_manager != null) {
- breakpoint_manager.Dispose ();
- breakpoint_manager = null;
- }
-
- if (thread_db != null) {
- thread_db.Dispose ();
- thread_db = null;
- }
-
- if (thread_lock_mutex != null) {
- thread_lock_mutex.Dispose ();
- thread_lock_mutex = null;
- }
-
- exception_handlers = null;
-
- manager.RemoveProcess (this);
- }
-
private void Dispose (bool disposing)
{
// Check to see if Dispose has already been called.
@@ -1124,8 +247,12 @@ namespace Mono.Debugger
}
// If this is a call to Dispose, dispose all managed resources.
- if (disposing)
- DoDispose ();
+ if (disposing) {
+ if (servant != null) {
+ servant.Dispose ();
+ servant = null;
+ }
+ }
}
public void Dispose ()
diff --git a/classes/Semaphore.cs b/classes/Semaphore.cs
new file mode 100644
index 0000000..f3d2dfc
--- /dev/null
+++ b/classes/Semaphore.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Mono.Debugger.Backend
+{
+ public static class Semaphore
+ {
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_server_sem_init ();
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_server_sem_wait ();
+
+ [DllImport("monodebuggerserver")]
+ static extern void mono_debugger_server_sem_post ();
+
+ [DllImport("monodebuggerserver")]
+ static extern int mono_debugger_server_sem_get_value ();
+
+ static Semaphore ()
+ {
+ mono_debugger_server_sem_init ();
+ }
+
+ public static void Wait ()
+ {
+ Report.Debug (DebugFlags.Mutex, "{0} waiting for semaphore",
+ DebuggerWaitHandle.CurrentThread);
+ mono_debugger_server_sem_wait ();
+ Report.Debug (DebugFlags.Mutex, "{0} done waiting for semaphore",
+ DebuggerWaitHandle.CurrentThread);
+ }
+
+ public static void Set ()
+ {
+ Report.Debug (DebugFlags.Mutex, "{0} signalling semaphore",
+ DebuggerWaitHandle.CurrentThread);
+ mono_debugger_server_sem_post ();
+ }
+
+ public static int Value {
+ get {
+ return mono_debugger_server_sem_get_value ();
+ }
+ }
+ }
+}
diff --git a/classes/Thread.cs b/classes/Thread.cs
index 6500c36..23584d4 100644
--- a/classes/Thread.cs
+++ b/classes/Thread.cs
@@ -18,7 +18,7 @@ namespace Mono.Debugger
[Serializable]
internal delegate object TargetAccessDelegate (Thread target, object user_data);
- public sealed class Thread : DebuggerMarshalByRefObject, IOperationHost
+ public class Thread : DebuggerMarshalByRefObject, IOperationHost
{
[Flags]
public enum Flags {
@@ -45,7 +45,7 @@ namespace Mono.Debugger
get { return servant.WaitHandle; }
}
- internal Language NativeLanguage {
+ protected internal Language NativeLanguage {
get {
check_servant ();
return servant.NativeLanguage;
@@ -137,10 +137,17 @@ namespace Mono.Debugger
}
}
+ internal ProcessServant ProcessServant {
+ get {
+ check_servant ();
+ return servant.ProcessServant;
+ }
+ }
+
public Process Process {
get {
check_servant ();
- return servant.Process;
+ return ProcessServant.Client;
}
}
@@ -297,12 +304,12 @@ namespace Mono.Debugger
}
}
- ThreadCommandResult Old_Step (StepMode mode)
+ protected ThreadCommandResult Old_Step (StepMode mode)
{
return Old_Step (mode, null);
}
- ThreadCommandResult Old_Step (StepMode mode, StepFrame frame)
+ protected ThreadCommandResult Old_Step (StepMode mode, StepFrame frame)
{
lock (this) {
check_alive ();
@@ -480,7 +487,7 @@ namespace Mono.Debugger
void IOperationHost.SendResult (SingleSteppingEngine sse, TargetEventArgs args)
{
- sse.Process.Debugger.OnTargetEvent (sse.Client, args);
+ sse.Process.Debugger.SendTargetEvent (sse, args);
}
void IOperationHost.Abort ()
@@ -778,13 +785,21 @@ namespace Mono.Debugger
#region IDisposable implementation
private bool disposed = false;
- void check_disposed ()
+ protected void check_disposed ()
{
if (disposed)
throw new ObjectDisposedException ("Thread");
}
- void Dispose (bool disposing)
+ protected virtual void DoDispose ()
+ {
+ if (servant != null) {
+ servant.Dispose ();
+ servant = null;
+ }
+ }
+
+ protected virtual void Dispose (bool disposing)
{
// Check to see if Dispose has already been called.
if (disposed)
@@ -794,10 +809,7 @@ namespace Mono.Debugger
// If this is a call to Dispose, dispose all managed resources.
if (disposing) {
- if (servant != null) {
- servant.Dispose ();
- servant = null;
- }
+ DoDispose ();
}
}
diff --git a/config.h.in b/config.h.in
index 1913298..98feeff 100644
--- a/config.h.in
+++ b/config.h.in
@@ -130,8 +130,5 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
-/* Whether we're using Mono from trunk */
-#undef USING_MONO_FROM_TRUNK
-
/* Version number of package */
#undef VERSION
diff --git a/configure b/configure
index 9eee06e..59ff90a 100755
--- a/configure
+++ b/configure
@@ -786,8 +786,6 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
-MONO_TRUNK_FALSE
-MONO_TRUNK_TRUE
DISABLED_FALSE
DISABLED_TRUE
MARTIN_PRIVATE_FALSE
@@ -799,6 +797,7 @@ HAVE_XSP_TRUE
XSP_EXE
XSP_LIBS
XSP_CFLAGS
+READLINE_DEPLIBS
LIB_SUFFIX
LIB_PREFIX
LD_LIBRARY_PATH
@@ -826,6 +825,8 @@ SERVER_DEPENDENCIES_LIBS
SERVER_DEPENDENCIES_CFLAGS
BASE_DEPENDENCIES_LIBS
BASE_DEPENDENCIES_CFLAGS
+COMPILING_FROM_SVN_FALSE
+COMPILING_FROM_SVN_TRUE
PKG_CONFIG
OTOOL64
OTOOL
@@ -2582,7 +2583,7 @@ fi
# Define the identity of the package.
PACKAGE=mono-debugger
- VERSION=2.10
+ VERSION=2.6.3
cat >>confdefs.h <<_ACEOF
@@ -6182,13 +6183,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:6185: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:6186: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:6188: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:6189: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:6191: output\"" >&5)
+ (eval echo "\"\$as_me:6192: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -7393,7 +7394,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 7396 "configure"' > conftest.$ac_ext
+ echo '#line 7397 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8831,11 +8832,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8834: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8835: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8838: \$? = $ac_status" >&5
+ echo "$as_me:8839: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9170,11 +9171,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9173: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9174: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9177: \$? = $ac_status" >&5
+ echo "$as_me:9178: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9275,11 +9276,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9278: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9279: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9282: \$? = $ac_status" >&5
+ echo "$as_me:9283: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9330,11 +9331,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9333: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9334: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9337: \$? = $ac_status" >&5
+ echo "$as_me:9338: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12130,7 +12131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12133 "configure"
+#line 12134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12226,7 +12227,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12229 "configure"
+#line 12230 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12815,7 +12816,7 @@ _ACEOF
-CFLAGS="-g ${CFLAGS} -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings -fno-strict-aliasing"
+CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings -fno-strict-aliasing'
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
@@ -12864,6 +12865,25 @@ $as_echo "$as_me: error: You need to install pkg-config" >&2;}
{ (exit 1); exit 1; }; }
fi
+{ $as_echo "$as_me:$LINENO: checking whether we're compiling from SVN" >&5
+$as_echo_n "checking whether we're compiling from SVN... " >&6; }
+if test -f "$srcdir/.svn_version" ; then
+ from_svn=yes
+else
+ from_svn=no
+fi
+{ $as_echo "$as_me:$LINENO: result: $from_svn" >&5
+$as_echo "$from_svn" >&6; }
+
+ if test x$from_svn = xyes; then
+ COMPILING_FROM_SVN_TRUE=
+ COMPILING_FROM_SVN_FALSE='#'
+else
+ COMPILING_FROM_SVN_TRUE='#'
+ COMPILING_FROM_SVN_FALSE=
+fi
+
+
pkg_config_path=
# Check whether --with-crosspkgdir was given.
@@ -13114,29 +13134,6 @@ fi
-debugger_major_version=81
-min_debugger_minor_version=0
-symfile_major_version=50
-min_symfile_minor_version=0
-
-{ $as_echo "$as_me:$LINENO: checking Whether we're using Mono from trunk" >&5
-$as_echo_n "checking Whether we're using Mono from trunk... " >&6; }
-## Check for Mono from trunk
-if pkg-config --modversion mono-2>/dev/null; then
- have_mono_trunk=true
- mono_pc=mono-2
- min_debugger_minor_version=6
- server_deps="glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps"
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- have_mono_trunk=false
- mono_pc=mono
- server_deps="$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps"
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
## Versions of dependencies
pkg_failed=no
@@ -13147,12 +13144,12 @@ if test -n "$SERVER_DEPENDENCIES_CFLAGS"; then
pkg_cv_SERVER_DEPENDENCIES_CFLAGS="$SERVER_DEPENDENCIES_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$server_deps\"") >&5
- ($PKG_CONFIG --exists --print-errors "$server_deps") 2>&5
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_REQUIRED_VERSION glib-2.0 >= \$GLIB_REQUIRED_VERSION \$martin_deps\"") >&5
+ ($PKG_CONFIG --exists --print-errors "mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_SERVER_DEPENDENCIES_CFLAGS=`$PKG_CONFIG --cflags "$server_deps" 2>/dev/null`
+ pkg_cv_SERVER_DEPENDENCIES_CFLAGS=`$PKG_CONFIG --cflags "mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -13163,12 +13160,12 @@ if test -n "$SERVER_DEPENDENCIES_LIBS"; then
pkg_cv_SERVER_DEPENDENCIES_LIBS="$SERVER_DEPENDENCIES_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$server_deps\"") >&5
- ($PKG_CONFIG --exists --print-errors "$server_deps") 2>&5
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_REQUIRED_VERSION glib-2.0 >= \$GLIB_REQUIRED_VERSION \$martin_deps\"") >&5
+ ($PKG_CONFIG --exists --print-errors "mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_SERVER_DEPENDENCIES_LIBS=`$PKG_CONFIG --libs "$server_deps" 2>/dev/null`
+ pkg_cv_SERVER_DEPENDENCIES_LIBS=`$PKG_CONFIG --libs "mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -13186,14 +13183,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- SERVER_DEPENDENCIES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$server_deps" 2>&1`
+ SERVER_DEPENDENCIES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps" 2>&1`
else
- SERVER_DEPENDENCIES_PKG_ERRORS=`$PKG_CONFIG --print-errors "$server_deps" 2>&1`
+ SERVER_DEPENDENCIES_PKG_ERRORS=`$PKG_CONFIG --print-errors "mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$SERVER_DEPENDENCIES_PKG_ERRORS" >&5
- { { $as_echo "$as_me:$LINENO: error: Package requirements ($server_deps) were not met:
+ { { $as_echo "$as_me:$LINENO: error: Package requirements (mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps) were not met:
$SERVER_DEPENDENCIES_PKG_ERRORS
@@ -13204,7 +13201,7 @@ Alternatively, you may set the environment variables SERVER_DEPENDENCIES_CFLAGS
and SERVER_DEPENDENCIES_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" >&5
-$as_echo "$as_me: error: Package requirements ($server_deps) were not met:
+$as_echo "$as_me: error: Package requirements (mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps) were not met:
$SERVER_DEPENDENCIES_PKG_ERRORS
@@ -13272,12 +13269,12 @@ if test -n "$WRAPPER_CFLAGS"; then
pkg_cv_WRAPPER_CFLAGS="$WRAPPER_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$mono_pc >= \$MONO_REQUIRED_VERSION glib-2.0 >= \$GLIB_REQUIRED_VERSION\"") >&5
- ($PKG_CONFIG --exists --print-errors "$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION") 2>&5
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_REQUIRED_VERSION gthread-2.0 >= \$GLIB_REQUIRED_VERSION\"") >&5
+ ($PKG_CONFIG --exists --print-errors "mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_WRAPPER_CFLAGS=`$PKG_CONFIG --cflags "$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>/dev/null`
+ pkg_cv_WRAPPER_CFLAGS=`$PKG_CONFIG --cflags "mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -13288,12 +13285,12 @@ if test -n "$WRAPPER_LIBS"; then
pkg_cv_WRAPPER_LIBS="$WRAPPER_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$mono_pc >= \$MONO_REQUIRED_VERSION glib-2.0 >= \$GLIB_REQUIRED_VERSION\"") >&5
- ($PKG_CONFIG --exists --print-errors "$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION") 2>&5
+ { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_REQUIRED_VERSION gthread-2.0 >= \$GLIB_REQUIRED_VERSION\"") >&5
+ ($PKG_CONFIG --exists --print-errors "mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_WRAPPER_LIBS=`$PKG_CONFIG --libs "$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>/dev/null`
+ pkg_cv_WRAPPER_LIBS=`$PKG_CONFIG --libs "mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -13311,14 +13308,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- WRAPPER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>&1`
+ WRAPPER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION" 2>&1`
else
- WRAPPER_PKG_ERRORS=`$PKG_CONFIG --print-errors "$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>&1`
+ WRAPPER_PKG_ERRORS=`$PKG_CONFIG --print-errors "mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$WRAPPER_PKG_ERRORS" >&5
- { { $as_echo "$as_me:$LINENO: error: Package requirements ($mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION) were not met:
+ { { $as_echo "$as_me:$LINENO: error: Package requirements (mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION) were not met:
$WRAPPER_PKG_ERRORS
@@ -13329,7 +13326,7 @@ Alternatively, you may set the environment variables WRAPPER_CFLAGS
and WRAPPER_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" >&5
-$as_echo "$as_me: error: Package requirements ($mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION) were not met:
+$as_echo "$as_me: error: Package requirements (mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION) were not met:
$WRAPPER_PKG_ERRORS
@@ -14511,6 +14508,176 @@ done
+ lib=""
+
+ old_LIBS=$LIBS
+
+ LIBS="-ltermcap"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+tgetent();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+
+ READLINE_DEPLIBS=$LIBS
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ LIBS="-lcurses"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+tgetent();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+
+ READLINE_DEPLIBS=$LIBS
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ LIBS="-lncurses"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+tgetent();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+
+ READLINE_DEPLIBS=$LIBS
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ { { $as_echo "$as_me:$LINENO: error: Cannot find termcap library" >&5
+$as_echo "$as_me: error: Cannot find termcap library" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+ LIBS=$old_LIBS
+
+
+
+min_mono_version=72
+symfile_major_version=50
+min_symfile_minor_version=0
+
+
# Check whether --with-xsp was given.
if test "${with_xsp+set}" = set; then
withval=$with_xsp; with_xsp=yes
@@ -14651,7 +14818,7 @@ fi
if test x$platform != xi386darwin ; then
{ $as_echo "$as_me:$LINENO: checking Whether your Mono is working" >&5
$as_echo_n "checking Whether your Mono is working... " >&6; }
-old_CFLAGS=$CFLAGS
+old_CFLAGS=$cflags
CFLAGS=$WRAPPER_CFLAGS
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -14666,10 +14833,7 @@ int
main ()
{
-#if MONO_DEBUGGER_MAJOR_VERSION != $debugger_major_version
-#error "Your mono is too old for this version of the debugger."
-#endif
-#if MONO_DEBUGGER_MINOR_VERSION < $min_debugger_minor_version
+#if MONO_DEBUGGER_MAJOR_VERSION < $min_mono_version
#error "Your mono is too old for this version of the debugger."
#endif
#if MONO_SYMBOL_FILE_MAJOR_VERSION != $symfile_major_version
@@ -14721,7 +14885,7 @@ fi
{ $as_echo "$as_me:$LINENO: checking Whether attaching is supported in this version of the Mono runtime" >&5
$as_echo_n "checking Whether attaching is supported in this version of the Mono runtime... " >&6; }
-old_CFLAGS=$CFLAGS
+old_CFLAGS=$cflags
CFLAGS=$WRAPPER_CFLAGS
#define MONO_DEBUGGER_MAJOR_VERSION 81
#define MONO_DEBUGGER_MINOR_VERSION 3
@@ -14822,23 +14986,7 @@ else
fi
-if test x$have_mono_trunk = xtrue; then
-
-cat >>confdefs.h <<\_ACEOF
-#define USING_MONO_FROM_TRUNK 1
-_ACEOF
-
-fi
- if test x$have_mono_trunk = xtrue; then
- MONO_TRUNK_TRUE=
- MONO_TRUNK_FALSE='#'
-else
- MONO_TRUNK_TRUE='#'
- MONO_TRUNK_FALSE=
-fi
-
-
-ac_config_files="$ac_config_files Makefile mono-debugger.pc mono-debugger-frontend.pc interface/Makefile classes/Makefile build/Makefile build/Mono.Debugger.dll.config sysdeps/Makefile sysdeps/bfd/libiberty/Makefile sysdeps/bfd/opcodes/Makefile sysdeps/bfd/Makefile sysdeps/bfd/hosts/Makefile sysdeps/bfd/include/Makefile sysdeps/bfd/include/aout/Makefile sysdeps/bfd/include/coff/Makefile sysdeps/bfd/include/elf/Makefile sysdeps/bfd/include/opcode/Makefile sysdeps/server/Makefile backend/Makefile backend/arch/Makefile backend/mono/Makefile backend/os/Makefile symbolwriter/Makefile languages/Makefile languages/mono/Makefile languages/native/Makefile frontend/Makefile frontend/jay/Makefile test/Makefile test/src/Makefile test/misc/Makefile test/framework/Makefile test/testsuite/Makefile doc/Makefile"
+ac_config_files="$ac_config_files Makefile mono-debugger.pc mono-debugger-frontend.pc interface/Makefile classes/Makefile build/Makefile build/Mono.Debugger.dll.config backend/Makefile backend/server/Makefile backend/arch/Makefile backend/mono/Makefile backend/os/Makefile backend/os/bfd/libiberty/Makefile backend/os/bfd/opcodes/Makefile backend/os/bfd/Makefile backend/os/bfd/hosts/Makefile backend/os/bfd/include/Makefile backend/os/bfd/include/aout/Makefile backend/os/bfd/include/coff/Makefile backend/os/bfd/include/elf/Makefile backend/os/bfd/include/opcode/Makefile symbolwriter/Makefile languages/Makefile languages/mono/Makefile languages/native/Makefile frontend/Makefile frontend/jay/Makefile frontend/libedit/Makefile test/Makefile test/src/Makefile test/misc/Makefile test/framework/Makefile test/testsuite/Makefile doc/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -15007,6 +15155,13 @@ $as_echo "$as_me: error: conditional \"PLATFORM_X86_64\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${COMPILING_FROM_SVN_TRUE}" && test -z "${COMPILING_FROM_SVN_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"COMPILING_FROM_SVN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"COMPILING_FROM_SVN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${HAVE_TARGET_MONO_TRUE}" && test -z "${HAVE_TARGET_MONO_FALSE}"; then
{ { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_TARGET_MONO\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -15042,13 +15197,6 @@ $as_echo "$as_me: error: conditional \"DISABLED\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${MONO_TRUNK_TRUE}" && test -z "${MONO_TRUNK_FALSE}"; then
- { { $as_echo "$as_me:$LINENO: error: conditional \"MONO_TRUNK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"MONO_TRUNK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -15822,27 +15970,27 @@ do
"classes/Makefile") CONFIG_FILES="$CONFIG_FILES classes/Makefile" ;;
"build/Makefile") CONFIG_FILES="$CONFIG_FILES build/Makefile" ;;
"build/Mono.Debugger.dll.config") CONFIG_FILES="$CONFIG_FILES build/Mono.Debugger.dll.config" ;;
- "sysdeps/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/Makefile" ;;
- "sysdeps/bfd/libiberty/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/libiberty/Makefile" ;;
- "sysdeps/bfd/opcodes/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/opcodes/Makefile" ;;
- "sysdeps/bfd/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/Makefile" ;;
- "sysdeps/bfd/hosts/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/hosts/Makefile" ;;
- "sysdeps/bfd/include/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/include/Makefile" ;;
- "sysdeps/bfd/include/aout/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/include/aout/Makefile" ;;
- "sysdeps/bfd/include/coff/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/include/coff/Makefile" ;;
- "sysdeps/bfd/include/elf/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/include/elf/Makefile" ;;
- "sysdeps/bfd/include/opcode/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/bfd/include/opcode/Makefile" ;;
- "sysdeps/server/Makefile") CONFIG_FILES="$CONFIG_FILES sysdeps/server/Makefile" ;;
"backend/Makefile") CONFIG_FILES="$CONFIG_FILES backend/Makefile" ;;
+ "backend/server/Makefile") CONFIG_FILES="$CONFIG_FILES backend/server/Makefile" ;;
"backend/arch/Makefile") CONFIG_FILES="$CONFIG_FILES backend/arch/Makefile" ;;
"backend/mono/Makefile") CONFIG_FILES="$CONFIG_FILES backend/mono/Makefile" ;;
"backend/os/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/Makefile" ;;
+ "backend/os/bfd/libiberty/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/libiberty/Makefile" ;;
+ "backend/os/bfd/opcodes/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/opcodes/Makefile" ;;
+ "backend/os/bfd/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/Makefile" ;;
+ "backend/os/bfd/hosts/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/hosts/Makefile" ;;
+ "backend/os/bfd/include/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/include/Makefile" ;;
+ "backend/os/bfd/include/aout/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/include/aout/Makefile" ;;
+ "backend/os/bfd/include/coff/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/include/coff/Makefile" ;;
+ "backend/os/bfd/include/elf/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/include/elf/Makefile" ;;
+ "backend/os/bfd/include/opcode/Makefile") CONFIG_FILES="$CONFIG_FILES backend/os/bfd/include/opcode/Makefile" ;;
"symbolwriter/Makefile") CONFIG_FILES="$CONFIG_FILES symbolwriter/Makefile" ;;
"languages/Makefile") CONFIG_FILES="$CONFIG_FILES languages/Makefile" ;;
"languages/mono/Makefile") CONFIG_FILES="$CONFIG_FILES languages/mono/Makefile" ;;
"languages/native/Makefile") CONFIG_FILES="$CONFIG_FILES languages/native/Makefile" ;;
"frontend/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/Makefile" ;;
"frontend/jay/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/jay/Makefile" ;;
+ "frontend/libedit/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/libedit/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
"test/src/Makefile") CONFIG_FILES="$CONFIG_FILES test/src/Makefile" ;;
"test/misc/Makefile") CONFIG_FILES="$CONFIG_FILES test/misc/Makefile" ;;
diff --git a/configure.in b/configure.in
index 8886327..5518bec 100644
--- a/configure.in
+++ b/configure.in
@@ -2,7 +2,7 @@
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono-debugger, 2.10)
+AM_INIT_AUTOMAKE(mono-debugger, 2.6.3)
AM_MAINTAINER_MODE
AC_CHECK_TOOL(CC, gcc, gcc)
@@ -106,13 +106,23 @@ AM_PROG_LIBTOOL
# not 64 bit clean in cross-compile
AC_CHECK_SIZEOF(void *, 4)
-CFLAGS="-g ${CFLAGS} -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings -fno-strict-aliasing"
+CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings -fno-strict-aliasing'
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
+AC_MSG_CHECKING([whether we're compiling from SVN])
+if test -f "$srcdir/.svn_version" ; then
+ from_svn=yes
+else
+ from_svn=no
+fi
+AC_MSG_RESULT($from_svn)
+
+AM_CONDITIONAL(COMPILING_FROM_SVN, test x$from_svn = xyes)
+
pkg_config_path=
AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
if test x$with_crosspkgdir = "x"; then
@@ -135,28 +145,8 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
AC_SUBST(BASE_DEPENDENCIES_CFLAGS)
AC_SUBST(BASE_DEPENDENCIES_LIBS)
-debugger_major_version=81
-min_debugger_minor_version=0
-symfile_major_version=50
-min_symfile_minor_version=0
-
-AC_MSG_CHECKING([Whether we're using Mono from trunk])
-## Check for Mono from trunk
-if pkg-config --modversion mono-2>/dev/null; then
- have_mono_trunk=true
- mono_pc=mono-2
- min_debugger_minor_version=6
- server_deps="glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps"
- AC_MSG_RESULT([yes])
-else
- have_mono_trunk=false
- mono_pc=mono
- server_deps="$mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps"
- AC_MSG_RESULT([no])
-fi
-
## Versions of dependencies
-PKG_CHECK_MODULES(SERVER_DEPENDENCIES, $server_deps)
+PKG_CHECK_MODULES(SERVER_DEPENDENCIES, mono >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION $martin_deps)
AC_SUBST(SERVER_DEPENDENCIES_CFLAGS)
AC_SUBST(SERVER_DEPENDENCIES_LIBS)
@@ -170,7 +160,7 @@ fi
CECIL_ASM=`pkg-config --variable=Libraries cecil`
AC_SUBST(CECIL_ASM)
-PKG_CHECK_MODULES(WRAPPER, $mono_pc >= $MONO_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION)
+PKG_CHECK_MODULES(WRAPPER, mono >= $MONO_REQUIRED_VERSION gthread-2.0 >= $GLIB_REQUIRED_VERSION)
AC_SUBST(WRAPPER_CFLAGS)
AC_SUBST(WRAPPER_LIBS)
@@ -272,6 +262,12 @@ AC_HEADER_DIRENT
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
AC_CHECK_FUNCS(strlcpy strlcat fgetln)
+CHECK_READLINE
+
+min_mono_version=72
+symfile_major_version=50
+min_symfile_minor_version=0
+
AC_ARG_WITH(xsp,
[ --with-xsp Enable XSP support (experimental)],
with_xsp=yes, with_xsp=no)
@@ -292,15 +288,12 @@ AM_CONDITIONAL(HAVE_XSP, test "x$with_xsp" = "xyes")
#not sure why, but I cannot get this test to pass on OS X.
if test x$platform != xi386darwin ; then
AC_MSG_CHECKING([Whether your Mono is working])
-old_CFLAGS=$CFLAGS
+old_CFLAGS=$cflags
CFLAGS=$WRAPPER_CFLAGS
AC_TRY_COMPILE([#include <mono/metadata/mono-debug.h>
#include <mono/metadata/debug-mono-symfile.h>
], [
-#if MONO_DEBUGGER_MAJOR_VERSION != $debugger_major_version
-#error "Your mono is too old for this version of the debugger."
-#endif
-#if MONO_DEBUGGER_MINOR_VERSION < $min_debugger_minor_version
+#if MONO_DEBUGGER_MAJOR_VERSION < $min_mono_version
#error "Your mono is too old for this version of the debugger."
#endif
#if MONO_SYMBOL_FILE_MAJOR_VERSION != $symfile_major_version
@@ -317,7 +310,7 @@ if test x$mono_working != xyes; then
fi
AC_MSG_CHECKING([Whether attaching is supported in this version of the Mono runtime])
-old_CFLAGS=$CFLAGS
+old_CFLAGS=$cflags
CFLAGS=$WRAPPER_CFLAGS
#define MONO_DEBUGGER_MAJOR_VERSION 81
#define MONO_DEBUGGER_MINOR_VERSION 3
@@ -355,11 +348,6 @@ AM_CONDITIONAL(MARTIN_PRIVATE, test x$martin_private = xyes)
AM_CONDITIONAL(DISABLED, false)
-if test x$have_mono_trunk = xtrue; then
- AC_DEFINE([USING_MONO_FROM_TRUNK], [1], [Whether we're using Mono from trunk])
-fi
-AM_CONDITIONAL(MONO_TRUNK, test x$have_mono_trunk = xtrue)
-
AC_OUTPUT([
Makefile
mono-debugger.pc
@@ -368,27 +356,27 @@ interface/Makefile
classes/Makefile
build/Makefile
build/Mono.Debugger.dll.config
-sysdeps/Makefile
-sysdeps/bfd/libiberty/Makefile
-sysdeps/bfd/opcodes/Makefile
-sysdeps/bfd/Makefile
-sysdeps/bfd/hosts/Makefile
-sysdeps/bfd/include/Makefile
-sysdeps/bfd/include/aout/Makefile
-sysdeps/bfd/include/coff/Makefile
-sysdeps/bfd/include/elf/Makefile
-sysdeps/bfd/include/opcode/Makefile
-sysdeps/server/Makefile
backend/Makefile
+backend/server/Makefile
backend/arch/Makefile
backend/mono/Makefile
backend/os/Makefile
+backend/os/bfd/libiberty/Makefile
+backend/os/bfd/opcodes/Makefile
+backend/os/bfd/Makefile
+backend/os/bfd/hosts/Makefile
+backend/os/bfd/include/Makefile
+backend/os/bfd/include/aout/Makefile
+backend/os/bfd/include/coff/Makefile
+backend/os/bfd/include/elf/Makefile
+backend/os/bfd/include/opcode/Makefile
symbolwriter/Makefile
languages/Makefile
languages/mono/Makefile
languages/native/Makefile
frontend/Makefile
frontend/jay/Makefile
+frontend/libedit/Makefile
test/Makefile
test/src/Makefile
test/misc/Makefile
diff --git a/debian/changelog b/debian/changelog
index d83e1ce..0fb08ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+mono-debugger (2.6.3-2.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * debian/patches
+ - (CVE-*): New patch. Fix CVE-2010-3369 insecure library loading
+ (grave, security; Closes: #598299).
+
+ -- Jari Aalto <jari.aalto at cante.net> Mon, 18 Oct 2010 13:01:07 +0300
+
mono-debugger (2.6.3-2) unstable; urgency=low
* Upload to Debian Unstable
diff --git a/debian/control b/debian/control
index 56b01ca..f4a0f47 100644
--- a/debian/control
+++ b/debian/control
@@ -3,19 +3,23 @@ Section: devel
Priority: optional
Maintainer: Debian Mono Group <pkg-mono-group at lists.alioth.debian.org>
Uploaders: Mirco Bauer <meebey at debian.org>
-Build-Depends: debhelper (>= 7.0.50~),
- dh-autoreconf,
+Build-Depends: debhelper (>= 5),
+ dpatch,
cli-common-dev (>= 0.4.4),
- mono-devel (>= 2.10),
+ mono-devel (>= 2.6.3),
nunit-console,
libnunit-cil-dev,
- libmono-2.0-dev,
+ autoconf,
+ automake,
+ autotools-dev,
+ libtool,
+ libmono-dev (>= 2.0),
libglib2.0-dev,
libreadline-dev
-Standards-Version: 3.9.1
+Standards-Version: 3.8.4
Homepage: http://www.mono-project.com/Debugger
-Vcs-Git: git://git.debian.org/git/pkg-mono/packages/mono-debugger/
-Vcs-Browser: http://git.debian.org/?p=pkg-mono/packages/mono-debugger.git
+Vcs-Svn: svn://svn.debian.org/pkg-mono/mono-debugger/trunk
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-mono/mono-debugger/trunk/
Package: mono-debugger
Architecture: i386 amd64
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644
index 0000000..f38a32a
--- /dev/null
+++ b/debian/patches/00list
@@ -0,0 +1,3 @@
+use_real_nunit
+fix_dllmap
+cve-2010-3369--bug598299
diff --git a/debian/patches/cve-2010-3369--bug598299.dpatch b/debian/patches/cve-2010-3369--bug598299.dpatch
new file mode 100644
index 0000000..7704d1c
--- /dev/null
+++ b/debian/patches/cve-2010-3369--bug598299.dpatch
@@ -0,0 +1,68 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## /tmp/CVE-2010-3369--bug598299.patch.dpatch by jaalto <jari.aalto at cante.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP:
+## DP: Author: Jari Aalto <jari.aalto at cante.net>
+## DP:
+## DP:
+## DP:
+## DP:
+## DP: Signed-off-by: Jari Aalto <jari.aalto at cante.net>
+
+ at DPATCH@
+
+diff --git a/build/mdb-symbolreader.in b/build/mdb-symbolreader.in
+old mode 100644
+new mode 100755
+index 7138bd0..627c2c1
+--- a/build/mdb-symbolreader.in
++++ b/build/mdb-symbolreader.in
+@@ -1,3 +1,18 @@
+ #!/bin/sh
+-export LD_LIBRARY_PATH="@libdir@:${LD_LIBRARY_PATH}"
+-exec @mono@ --debug @twodir@/mdb-symbolreader.exe $*
++
++Pathclean ()
++{
++ # Vulnerability fix for insecure path content
++ # Make sure "::", "^:" or ":$" is not left in path arg $1
++
++ local tmp
++ tmp=$(echo "$1" | sed -e 's/::\+// ; s/^:// ; s/:$//' )
++
++ [ "$tmp" ] && echo "$tmp"
++}
++
++LD_LIBRARY_PATH="@libdir@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
++LD_LIBRARY_PATH=$(Pathclean "$LD_LIBRARY_PATH")
++export LD_LIBRARY_PATH
++
++exec @mono@ --debug @twodir@/mdb-symbolreader.exe "$@"
+diff --git a/build/mdb.in b/build/mdb.in
+old mode 100644
+new mode 100755
+index 12da6c3..8546d0b
+--- a/build/mdb.in
++++ b/build/mdb.in
+@@ -1,3 +1,18 @@
+ #!/bin/sh
+-export LD_LIBRARY_PATH="@libdir@:${LD_LIBRARY_PATH}"
+-exec @mono@ --debug @twodir@/mdb.exe $*
++
++Pathclean ()
++{
++ # Vulnerability fix for insecure path content
++ # Make sure "::", "^:" or ":$" is not left in path arg $1
++
++ local tmp
++ tmp=$(echo "$1" | sed -e 's/::\+// ; s/^:// ; s/:$//' )
++
++ [ "$tmp" ] && echo "$tmp"
++}
++
++LD_LIBRARY_PATH="@libdir@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
++LD_LIBRARY_PATH=$(Pathclean "$LD_LIBRARY_PATH")
++export LD_LIBRARY_PATH
++
++exec @mono@ --debug @twodir@/mdb.exe "$@"
diff --git a/debian/patches/fix_Makefile.am.dpatch b/debian/patches/fix_Makefile.am.dpatch
new file mode 100644
index 0000000..8db9be3
--- /dev/null
+++ b/debian/patches/fix_Makefile.am.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix_Makefile.am.dpatch by Mirco Bauer <meebey at meebey.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad mono-debugger-0.12+svn.r59605~/build/Makefile.am mono-debugger-0.12+svn.r59605/build/Makefile.am
+--- mono-debugger-0.12+svn.r59605~/build/Makefile.am 2006-04-18 20:02:56.000000000 +0200
++++ mono-debugger-0.12+svn.r59605/build/Makefile.am 2006-04-18 20:06:41.000000000 +0200
+@@ -8,7 +8,7 @@
+
+ noinst_SCRIPTS = Mono.Debugger.dll Mono.Debugger.Frontend.dll Mono.Debugger.Test.dll
+
+-EXTRA_DATA = Mono.Debugger.Cecil.dll
++#EXTRA_DATA = Mono.Debugger.Cecil.dll
+
+ LANGUAGE_SPECIFIC_FILES = \
+ $(top_builddir)/frontend/CSharpExpressionParser.cs \
diff --git a/debian/patches/fix_build_with_libc_r98147_r98369.dpatch b/debian/patches/fix_build_with_libc_r98147_r98369.dpatch
new file mode 100644
index 0000000..eda9ae7
--- /dev/null
+++ b/debian/patches/fix_build_with_libc_r98147_r98369.dpatch
@@ -0,0 +1,58 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix_build_with_libc_r98147.dpatch by Mirco Bauer <meebey at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad mono-debugger-0.60+dfsg~/backend/server/i386-arch.h mono-debugger-0.60+dfsg/backend/server/i386-arch.h
+--- mono-debugger-0.60+dfsg~/backend/server/i386-arch.h 2008-06-01 15:16:40.000000000 +0200
++++ mono-debugger-0.60+dfsg/backend/server/i386-arch.h 2008-06-01 15:17:40.000000000 +0200
+@@ -7,10 +7,10 @@
+
+ #if defined(__i386__)
+
+-#include <asm/user.h>
++#include <sys/user.h>
+
+ #define INFERIOR_REGS_TYPE struct user_regs_struct
+-#define INFERIOR_FPREGS_TYPE struct user_i387_struct
++#define INFERIOR_FPREGS_TYPE struct user_fpregs_struct
+
+ #define INFERIOR_REG_EIP(r) r.eip
+ #define INFERIOR_REG_ESP(r) r.esp
+@@ -23,12 +23,12 @@
+ #define INFERIOR_REG_EDI(r) r.edi
+ #define INFERIOR_REG_EFLAGS(r) r.eflags
+ #define INFERIOR_REG_ESP(r) r.esp
+-#define INFERIOR_REG_FS(r) r.fs
+-#define INFERIOR_REG_ES(r) r.es
+-#define INFERIOR_REG_DS(r) r.ds
+-#define INFERIOR_REG_CS(r) r.cs
+-#define INFERIOR_REG_SS(r) r.ss
+-#define INFERIOR_REG_GS(r) r.gs
++#define INFERIOR_REG_FS(r) r.xfs
++#define INFERIOR_REG_ES(r) r.xes
++#define INFERIOR_REG_DS(r) r.xds
++#define INFERIOR_REG_CS(r) r.xcs
++#define INFERIOR_REG_SS(r) r.xss
++#define INFERIOR_REG_GS(r) r.xgs
+
+ G_END_DECLS
+
+diff -urNad mono-debugger-0.60+dfsg~/backend/server/x86_64-arch.h mono-debugger-0.60+dfsg/backend/server/x86_64-arch.h
+--- mono-debugger-0.60+dfsg~/backend/server/x86_64-arch.h 2008-06-01 15:16:40.000000000 +0200
++++ mono-debugger-0.60+dfsg/backend/server/x86_64-arch.h 2008-06-01 15:17:25.000000000 +0200
+@@ -7,10 +7,10 @@
+
+ #if defined(__x86_64__)
+
+-#include <asm/user.h>
++#include <sys/user.h>
+
+ #define INFERIOR_REGS_TYPE struct user_regs_struct
+-#define INFERIOR_FPREGS_TYPE struct user_i387_struct
++#define INFERIOR_FPREGS_TYPE struct user_fpregs_struct
+
+ #define INFERIOR_REG_R15(r) r.r15
+ #define INFERIOR_REG_R14(r) r.r14
diff --git a/debian/patches/fix_dllmap.patch b/debian/patches/fix_dllmap.dpatch
old mode 100755
new mode 100644
similarity index 100%
rename from debian/patches/fix_dllmap.patch
rename to debian/patches/fix_dllmap.dpatch
diff --git a/debian/patches/link_system_libs.dpatch b/debian/patches/link_system_libs.dpatch
new file mode 100644
index 0000000..393e707
--- /dev/null
+++ b/debian/patches/link_system_libs.dpatch
@@ -0,0 +1,110 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## link_system_libs.dpatch by Mirco Bauer <meebey at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad mono-debugger-0.60+dfsg~/build/Makefile.am mono-debugger-0.60+dfsg/build/Makefile.am
+--- mono-debugger-0.60+dfsg~/build/Makefile.am 2007-12-23 01:56:41.000000000 +0100
++++ mono-debugger-0.60+dfsg/build/Makefile.am 2007-12-23 01:57:01.000000000 +0100
+@@ -12,7 +12,6 @@
+ Mono.Debugger.Frontend.dll \
+ Mono.Debugger.Test.dll
+
+-EXTRA_DATA = Mono.Debugger.Cecil.dll
+
+ LANGUAGE_SPECIFIC_FILES = \
+ $(top_builddir)/frontend/CSharpExpressionParser.cs \
+@@ -61,7 +60,7 @@
+ -r:Mono.GetOptions \
+ -r:Mono.CompilerServices.SymbolWriter \
+ -r:System.Runtime.Serialization.Formatters.Soap \
+- -r:$(srcdir)/Mono.Debugger.Cecil.dll \
++ $$(pkg-config --libs mono-cecil) \
+ -r:./Mono.Debugger.dll
+
+ MDB_DEPS = \
+@@ -77,7 +76,7 @@
+ -r:./Mono.Debugger.Frontend.dll \
+ $$(pkg-config --libs nunit)
+
+-Mono.Debugger.Backend.dll: Makefile $(srcdir)/Mono.Debugger.Cecil.dll $(BACKEND_SRCLIST) Mono.Debugger.dll
++Mono.Debugger.Backend.dll: Makefile $(BACKEND_SRCLIST) Mono.Debugger.dll
+ $(MCS) -target:library -out:Mono.Debugger.Backend.dll $(MCS_FLAGS) -keyfile:$(top_srcdir)/build/mono.snk -resource:$(top_srcdir)/classes/DebuggerConfiguration.xsd,DebuggerConfiguration $(BACKEND_DEPS) $(BACKEND_SRCLIST)
+
+ Mono.Debugger.dll: Makefile $(INTERFACE_SRCLIST)
+@@ -114,21 +113,18 @@
+
+ EXTRA_DIST = \
+ mdb.in mono.snk AssemblyInfo.cs.in Mono.Debugger.dll.config.in \
+- Mono.Debugger.Cecil.dll
+
+ mdb: mdb.in Makefile
+ sed -e 's^\@onedir\@^$(onedir)^g' < $(srcdir)/mdb.in > mdb.tmp \
+ && mv mdb.tmp mdb
+
+ install-data-local:
+- $(GACUTIL) /i $(srcdir)/Mono.Debugger.Cecil.dll /f $(GACUTIL_FLAGS) || exit 1;
+ $(GACUTIL) /i Mono.Debugger.Backend.dll /f $(GACUTIL_FLAGS) || exit 1;
+ $(GACUTIL) /i Mono.Debugger.dll /f $(GACUTIL_FLAGS) || exit 1;
+
+ uninstall-local:
+ $(GACUTIL) /u Mono.Debugger $(GACUTIL_FLAGS) || exit 1;
+ $(GACUTIL) /u Mono.Debugger.Backend $(GACUTIL_FLAGS) || exit 1;
+- $(GACUTIL) /u Mono.Debugger.Cecil $(GACUTIL_FLAGS) || exit 1;
+
+ NUNIT_CONSOLE_FLAGS =
+
+diff -urNad mono-debugger-0.60+dfsg~/build/Makefile.in mono-debugger-0.60+dfsg/build/Makefile.in
+--- mono-debugger-0.60+dfsg~/build/Makefile.in 2007-12-23 01:56:41.000000000 +0100
++++ mono-debugger-0.60+dfsg/build/Makefile.in 2007-12-23 01:57:12.000000000 +0100
+@@ -201,7 +201,6 @@
+ Mono.Debugger.Frontend.dll \
+ Mono.Debugger.Test.dll
+
+-EXTRA_DATA = Mono.Debugger.Cecil.dll
+ LANGUAGE_SPECIFIC_FILES = \
+ $(top_builddir)/frontend/CSharpExpressionParser.cs \
+ $(top_srcdir)/frontend/CSharpTokenizer.cs
+@@ -249,7 +248,7 @@
+ -r:Mono.GetOptions \
+ -r:Mono.CompilerServices.SymbolWriter \
+ -r:System.Runtime.Serialization.Formatters.Soap \
+- -r:$(srcdir)/Mono.Debugger.Cecil.dll \
++ $$(pkg-config --libs mono-cecil) \
+ -r:./Mono.Debugger.dll
+
+ MDB_DEPS = \
+@@ -273,7 +272,6 @@
+
+ EXTRA_DIST = \
+ mdb.in mono.snk AssemblyInfo.cs.in Mono.Debugger.dll.config.in \
+- Mono.Debugger.Cecil.dll
+
+ NUNIT_CONSOLE_FLAGS =
+ all: all-am
+@@ -493,7 +491,7 @@
+ uninstall-binSCRIPTS uninstall-local uninstall-oneSCRIPTS
+
+
+-Mono.Debugger.Backend.dll: Makefile $(srcdir)/Mono.Debugger.Cecil.dll $(BACKEND_SRCLIST) Mono.Debugger.dll
++Mono.Debugger.Backend.dll: Makefile $(BACKEND_SRCLIST) Mono.Debugger.dll
+ $(MCS) -target:library -out:Mono.Debugger.Backend.dll $(MCS_FLAGS) -keyfile:$(top_srcdir)/build/mono.snk -resource:$(top_srcdir)/classes/DebuggerConfiguration.xsd,DebuggerConfiguration $(BACKEND_DEPS) $(BACKEND_SRCLIST)
+
+ Mono.Debugger.dll: Makefile $(INTERFACE_SRCLIST)
+@@ -526,14 +524,12 @@
+ && mv mdb.tmp mdb
+
+ install-data-local:
+- $(GACUTIL) /i $(srcdir)/Mono.Debugger.Cecil.dll /f $(GACUTIL_FLAGS) || exit 1;
+ $(GACUTIL) /i Mono.Debugger.Backend.dll /f $(GACUTIL_FLAGS) || exit 1;
+ $(GACUTIL) /i Mono.Debugger.dll /f $(GACUTIL_FLAGS) || exit 1;
+
+ uninstall-local:
+ $(GACUTIL) /u Mono.Debugger $(GACUTIL_FLAGS) || exit 1;
+ $(GACUTIL) /u Mono.Debugger.Backend $(GACUTIL_FLAGS) || exit 1;
+- $(GACUTIL) /u Mono.Debugger.Cecil $(GACUTIL_FLAGS) || exit 1;
+
+ check-local: Mono.Debugger.Test.dll $(TEST_CASE_SRCLIST)
+ LD_LIBRARY_PATH="$(top_builddir)/backend/server/.libs:$$LD_LIBRARY_PATH" $(NUNIT_CONSOLE) $(NUNIT_CONSOLE_FLAGS) /output:TestResult.log /exclude:NotWorking /xml:TestResult.xml Mono.Debugger.Test.dll || ok=false; \
diff --git a/debian/patches/lower_required_mono_version.dpatch b/debian/patches/lower_required_mono_version.dpatch
new file mode 100644
index 0000000..8482785
--- /dev/null
+++ b/debian/patches/lower_required_mono_version.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## lower_required_mono_version.dpatch by Mirco Bauer <meebey at meebey.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad mono-debugger-0.12+svn.r59605~/configure.in mono-debugger-0.12+svn.r59605/configure.in
+--- mono-debugger-0.12+svn.r59605~/configure.in 2006-04-18 20:02:56.000000000 +0200
++++ mono-debugger-0.12+svn.r59605/configure.in 2006-04-18 20:08:42.000000000 +0200
+@@ -136,7 +136,7 @@
+
+ ## Versions of dependencies
+ GLIB_REQUIRED_VERSION=2.0.0
+-MONO_REQUIRED_VERSION=1.1.15
++MONO_REQUIRED_VERSION=1.1.13.6
+
+
+ PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index f72ab6e..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,2 +0,0 @@
-use_real_nunit.patch
-fix_dllmap.patch
diff --git a/debian/patches/use_real_nunit.patch b/debian/patches/use_real_nunit.dpatch
old mode 100755
new mode 100644
similarity index 100%
rename from debian/patches/use_real_nunit.patch
rename to debian/patches/use_real_nunit.dpatch
diff --git a/debian/rules b/debian/rules
index a5662de..ed0a629 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,24 +9,79 @@ DEB_VERSION = $(shell dpkg-parsechangelog -l$(DEBIAN_DIR)/changelog | grep ^Vers
DEB_SOURCE_NAME = $(shell dpkg-parsechangelog -l$(DEBIAN_DIR)/changelog | grep ^Source | cut -d" " -f2)
VERSION = $(shell echo $(DEB_VERSION) | cut -d"-" -f1 | sed 's/+dfsg.*//')
-include /usr/share/cli-common/cli.make
+include /usr/share/dpatch/dpatch.make
-override_dh_auto_configure:
- dh_auto_configure -- --prefix=/usr MCS=/usr/bin/mono-csc
+CFLAGS = -Wall -g
-override_dh_install:
- dh_install
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp: patch-stamp
+ dh_testdir
+
+ libtoolize
+ aclocal
+ autoconf
+ automake --add-missing --copy
+
+ ./configure --prefix=/usr MCS=/usr/bin/mono-csc
+ touch configure-stamp
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+ $(MAKE)
+ touch build-stamp
+
+clean: clean-patched unpatch
+clean-patched:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+ rm -fr autom4te.cache
+ [ ! -f Makefile ] || $(MAKE) distclean
+ find . -name "Makefile.in" | xargs rm -fr
+ dh_clean config.sub config.guess aclocal.m4
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/mono-debugger
cp $(CURDIR)/debian/mdb.exe.config $(CURDIR)/debian/mono-debugger/usr/lib/mono/2.0/
rm $(CURDIR)/debian/mono-debugger/usr/lib/*.so
rm $(CURDIR)/debian/mono-debugger/usr/lib/*.la
-override_dh_makeshlibs:
- dh_makeshlibs -V
+binary-indep: build install
-override_dh_makeclilibs:
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+ dh_install
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_clifixperms
+ dh_makeshlibs -V
dh_makeclilibs -r
+ dh_installdeb
+ dh_shlibdeps
+ dh_clideps -d
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
-override_dh_auto_test:
+binary: binary-indep binary-arch
get-orig-source:
uscan \
@@ -37,6 +92,8 @@ get-orig-source:
--destdir . \
--force-download \
--rename
+ bzcat ./$(DEB_SOURCE_NAME)_$(VERSION).orig.tar.bz2 | \
+ gzip -9fn -c - > ./$(DEB_SOURCE_NAME)_$(VERSION).orig.tar.gz
+ rm ./$(DEB_SOURCE_NAME)_$(VERSION).orig.tar.bz2
-%:
- dh --with autoreconf $@
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 042c341..06502aa 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -127,6 +127,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/frontend/Command.cs b/frontend/Command.cs
index bc094af..ff3ab15 100644
--- a/frontend/Command.cs
+++ b/frontend/Command.cs
@@ -83,9 +83,7 @@ namespace Mono.Debugger.Frontend
RegisterAlias ("r", typeof (RunCommand));
RegisterCommand ("start", typeof (StartCommand));
RegisterCommand ("attach", typeof (AttachCommand));
-#if DISABLED
RegisterCommand ("core", typeof (OpenCoreFileCommand));
-#endif
RegisterCommand ("about", typeof (AboutCommand));
RegisterCommand ("lookup", typeof (LookupCommand));
RegisterCommand ("return", typeof (ReturnCommand));
@@ -142,17 +140,17 @@ namespace Mono.Debugger.Frontend
}
/* override this to provide command specific completion */
- public virtual string[] Complete (Engine e, string text)
+ public virtual void Complete (Engine e, string text, int start, int end)
{
if (text.StartsWith ("-")) {
/* do our super cool argument completion on the command's
* properties, if there are any.
*/
- return e.Completer.ArgumentCompleter (GetType(), text);
+ e.Completer.ArgumentCompleter (GetType(), text, start, end);
}
else {
/* otherwise punt */
- return e.Completer.NoopCompleter (text);
+ e.Completer.NoopCompleter (text, start, end);
}
}
}
@@ -1106,9 +1104,9 @@ namespace Mono.Debugger.Frontend
return file;
}
- public override string[] Complete (Engine e, string text)
+ public override void Complete (Engine e, string text, int start, int end)
{
- return e.Completer.FilenameCompleter (text);
+ e.Completer.FilenameCompleter (text, start, end);
}
// IDocumentableCommand
@@ -1177,9 +1175,9 @@ namespace Mono.Debugger.Frontend
}
}
- public override string[] Complete (Engine e, string text)
+ public override void Complete (Engine e, string text, int start, int end)
{
- return e.Completer.FilenameCompleter (text);
+ e.Completer.FilenameCompleter (text, start, end);
}
// IDocumentableCommand
@@ -1709,7 +1707,6 @@ namespace Mono.Debugger.Frontend
public string Documentation { get { return ""; } }
}
-#if DISABLED
public class OpenCoreFileCommand : DebuggerCommand, IDocumentableCommand
{
protected override bool DoResolve (ScriptingContext context)
@@ -1744,7 +1741,6 @@ namespace Mono.Debugger.Frontend
public string Description { get { return "Start debugged program."; } }
public string Documentation { get { return ""; } }
}
-#endif
public class KillCommand : ProcessCommand, IDocumentableCommand
{
@@ -1861,7 +1857,7 @@ namespace Mono.Debugger.Frontend
return subcommand.Execute (context);
}
- public override string[] Complete (Engine e, string text)
+ public override void Complete (Engine e, string text, int start, int end)
{
// this doesn't quite work yet. in the end it
// should allow completion of subcommand arguments,
@@ -1877,7 +1873,7 @@ namespace Mono.Debugger.Frontend
* completer. */
Type subcommand_type = (Type)subcommand_type_hash[(string) Args[0]];
if (subcommand_type == null) {
- return e.Completer.NoopCompleter (text);
+ e.Completer.NoopCompleter (text, start, end);
}
else {
/* copied from above */
@@ -1887,17 +1883,19 @@ namespace Mono.Debugger.Frontend
new_args.Add (Args [i]);
subcommand.Args = new_args;
- return subcommand.Complete (e, text);
+ subcommand.Complete (e, text, start, end);
}
+
+ return;
}
if (subcommand_type_hash.Count == 0) {
- return e.Completer.NoopCompleter (text);
+ e.Completer.NoopCompleter (text, start, end);
}
else {
string[] haystack = new string[subcommand_type_hash.Count];
subcommand_type_hash.Keys.CopyTo (haystack, 0);
- return e.Completer.StringsCompleter (haystack, text);
+ e.Completer.StringsCompleter (haystack, text, start, end);
}
}
}
@@ -1978,11 +1976,11 @@ namespace Mono.Debugger.Frontend
return null;
}
- public override string[] Complete (Engine e, string text)
+ public override void Complete (Engine e, string text, int start, int end)
{
DebuggerEngine engine = (DebuggerEngine) e;
- return e.Completer.StringsCompleter (engine.Interpreter.GetStyleNames(), text);
+ e.Completer.StringsCompleter (engine.Interpreter.GetStyleNames(), text, start, end);
}
}
#endregion
@@ -3503,14 +3501,14 @@ namespace Mono.Debugger.Frontend
return null;
}
- public override string[] Complete (Engine e, string text)
+ public override void Complete (Engine e, string text, int start, int end)
{
if (text.StartsWith ("-")) {
- return e.Completer.ArgumentCompleter (GetType(), text);
+ e.Completer.ArgumentCompleter (GetType(), text, start, end);
}
else {
/* attempt filename completion */
- return e.Completer.FilenameCompleter (text);
+ e.Completer.FilenameCompleter (text, start, end);
}
}
@@ -3597,10 +3595,10 @@ namespace Mono.Debugger.Frontend
return null;
}
- public override string[] Complete (Engine e, string text) {
+ public override void Complete (Engine e, string text, int start, int end) {
/* arguments to the "help" command are commands
* themselves, so complete against them. */
- return e.Completer.CommandCompleter (text);
+ e.Completer.CommandCompleter (text, start, end);
}
// IDocumentableCommand
@@ -3872,7 +3870,7 @@ namespace Mono.Debugger.Frontend
config.RedirectOutput = enable;
break;
- case "stop-daemon":
+ case "stop-daemon-threads":
require_expert_mode ();
if (enable)
config.ThreadingModel |= ThreadingModel.StopDaemonThreads;
@@ -3880,7 +3878,7 @@ namespace Mono.Debugger.Frontend
config.ThreadingModel &= ~ThreadingModel.StopDaemonThreads;
break;
- case "stop-immutable":
+ case "stop-immutable-threads":
require_expert_mode ();
if (enable)
config.ThreadingModel |= ThreadingModel.StopImmutableThreads;
@@ -3943,10 +3941,10 @@ namespace Mono.Debugger.Frontend
process.WaitForExit ();
}
- public override string[] Complete (Engine e, string text)
+ public override void Complete (Engine e, string text, int start, int end)
{
/* attempt filename completion */
- return e.Completer.FilenameCompleter (text);
+ e.Completer.FilenameCompleter (text, start, end);
}
// IDocumentableCommand
diff --git a/frontend/Completer.cs b/frontend/Completer.cs
index 6aa74eb..0674f28 100644
--- a/frontend/Completer.cs
+++ b/frontend/Completer.cs
@@ -1,15 +1,11 @@
using System;
+using System.Collections;
using System.IO;
-using System.Linq;
using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Mono.Debugger.Frontend
{
- using Mono.Terminal;
-
public class Completer {
private Engine engine;
@@ -17,55 +13,55 @@ namespace Mono.Debugger.Frontend
this.engine = engine;
}
- public LineEditor.Completion Complete (string text, int start)
- {
- if (start == 0)
- return new LineEditor.Completion ("", CommandCompleter (text));
-
- string command;
-
- int ptr = 0;
- while (!Char.IsWhiteSpace (text[ptr]))
- ++ptr;
-
- command = text.Substring (0, ptr);
- text = text.Substring (ptr + 1);
-
- Command c = engine.Get (command, null);
- if (c == null)
- return null;
-
- var completion = c.Complete (engine, text);
- if (completion == null)
- return null;
-
- var choices = new List<string> (completion);
-
- string prefix = ComputeMCP (choices, text);
- var results = choices.Select (k => k.Substring (prefix.Length)).ToArray ();
-
- return new LineEditor.Completion (prefix, results);
+ /* This method gets installed as the LineReader completion
+ * delegate. It completes commands at the start of the
+ * line, and does command specific completion for
+ * arguments. */
+ public void CompletionHandler (string text, int start, int end) {
+ if (start == 0) {
+ CommandCompleter (text, start, end);
+ }
+ else {
+ /* we look up the command in the
+ * current line buffer and call that
+ * command's completion generator to
+ * generate the list of strings.
+ */
+
+ string line = LineReader.CurrentLine;
+ string command;
+
+ int ptr = 0;
+ while (!Char.IsWhiteSpace (line[ptr]))
+ ++ptr;
+
+ command = line.Substring (0, ptr);
+ Command c = engine.Get (command, null);
+ if (c != null) {
+ c.Complete (engine, text, start, end);
+ }
+ }
}
- string ComputeMCP (List<string> choices, string initial_prefix)
+ string ComputeMCP (ArrayList choices, string initial_prefix)
{
- string s = choices[0];
+ string s = (string)choices[0];
int maxlen = s.Length;
for (int i = 1; i < choices.Count; i ++) {
- if (maxlen > choices[i].Length)
- maxlen = choices[i].Length;
+ if (maxlen > ((string)choices[i]).Length)
+ maxlen = ((string)choices[i]).Length;
}
s = s.Substring (0, maxlen);
- for (int l = initial_prefix.Length; l < maxlen; l++) {
+ for (int l = initial_prefix.Length; l < maxlen; l ++) {
for (int i = 1; i < choices.Count; i ++) {
- string test = choices[i];
+ string test = (string)choices[i];
if (test[l] != s[l])
return s.Substring (0, l);
}
}
-
+
return s;
}
@@ -77,35 +73,68 @@ namespace Mono.Debugger.Frontend
* (but not aliases) that have been registered with the
* engine. This is used by the CompletionHandler itself to
* complete commands at the beginning of the line. */
- public string[] CommandCompleter (string text)
+ public void CommandCompleter (string text, int start, int end)
{
/* complete possible commands */
- var matches = new List<string> ();
+ ArrayList matched_commands = new ArrayList();
string[] match_strings = null;
foreach (string key in engine.Commands.Keys) {
if (key.StartsWith (text))
- matches.Add (key);
+ matched_commands.Add (key);
+ }
+
+
+ if (matched_commands.Count > 0) {
+ if (matched_commands.Count > 1) {
+ /* always add the prefix at
+ * the beginning when we have
+ * > 1 matches, so that
+ * readline will display the
+ * matches. */
+ matched_commands.Insert (0, ComputeMCP (matched_commands, text));
+ }
+
+ match_strings = new string [matched_commands.Count + 1];
+ matched_commands.CopyTo (match_strings);
+ match_strings [matched_commands.Count] = null;
}
- return matches.ToArray ();
+ LineReader.SetCompletionMatches (match_strings);
}
- public string[] StringsCompleter (string[] haystack, string text)
+ public void StringsCompleter (string[] haystack, string text, int start, int end)
{
- var matches = new List<string> ();
+ ArrayList matches = new ArrayList();
foreach (string s in haystack) {
if (s.ToLower().StartsWith (text))
matches.Add (s.ToLower());
}
- return matches.ToArray ();
+ string[] match_strings = null;
+
+ if (matches.Count > 0) {
+ if (matches.Count > 1) {
+ /* always add the prefix at
+ * the beginning when we have
+ * > 1 matches, so that
+ * readline will display the
+ * matches. */
+ matches.Insert (0, ComputeMCP (matches, text));
+ }
+
+ match_strings = new string [matches.Count + 1];
+ matches.CopyTo (match_strings);
+ match_strings [matches.Count] = null;
+ }
+
+ LineReader.SetCompletionMatches (match_strings);
}
- public string[] ArgumentCompleter (Type t, string text)
+ public void ArgumentCompleter (Type t, string text, int start, int end)
{
- var matches = new List<string> ();
+ ArrayList matched_args = new ArrayList();
PropertyInfo [] pi = t.GetProperties ();
foreach (PropertyInfo p in pi) {
@@ -113,21 +142,40 @@ namespace Mono.Debugger.Frontend
continue;
if (text == "-" ||
p.Name.ToLower().StartsWith (text.Substring (1))) {
- matches.Add ("-" + p.Name.ToLower());
+ matched_args.Add ("-" + p.Name.ToLower());
+ }
+ }
+
+ string[] match_strings = null;
+
+ if (matched_args.Count > 0) {
+ if (matched_args.Count > 1) {
+ /* always add the prefix at
+ * the beginning when we have
+ * > 1 matches, so that
+ * readline will display the
+ * matches. */
+ matched_args.Insert (0, ComputeMCP (matched_args, text));
}
+
+ match_strings = new string [matched_args.Count + 1];
+ matched_args.CopyTo (match_strings);
+ match_strings [matched_args.Count] = null;
}
- return matches.ToArray ();
+ LineReader.SetCompletionMatches (match_strings);
}
- public string[] FilenameCompleter (string text)
+ public void FilenameCompleter (string text, int start, int end)
{
string dir;
string file_prefix;
DebuggerEngine de = engine as DebuggerEngine;
+ LineReader.FilenameCompletionDesired = true;
+
if (text.IndexOf (Path.DirectorySeparatorChar) == -1) {
- dir = de.Interpreter.Options.WorkingDirectory ?? Environment.CurrentDirectory;
+ dir = de.Interpreter.Options.WorkingDirectory;
file_prefix = text;
}
else {
@@ -140,30 +188,49 @@ namespace Mono.Debugger.Frontend
try {
fs_entries = Directory.GetFileSystemEntries (dir, file_prefix + "*");
} catch {
- return null;
+ LineReader.SetCompletionMatches (null);
+ return;
}
- var matched_paths = new List<string> ();
+ ArrayList matched_paths = new ArrayList();
foreach (string f in fs_entries) {
- if (f.StartsWith (Path.Combine (dir, file_prefix))) {
+ if (f.StartsWith (dir + file_prefix)) {
matched_paths.Add (f);
}
}
- return matched_paths.ToArray ();
+ string[] match_strings = null;
+
+ if (matched_paths.Count > 0) {
+ if (matched_paths.Count > 1) {
+ /* always add the prefix at
+ * the beginning when we have
+ * > 1 matches, so that
+ * readline will display the
+ * matches. */
+ matched_paths.Insert (0, ComputeMCP (matched_paths, text));
+ }
+
+ match_strings = new string [matched_paths.Count + 1];
+ matched_paths.CopyTo (match_strings);
+ match_strings [matched_paths.Count] = null;
+ }
+
+ LineReader.SetCompletionMatches (match_strings);
+
}
/* NoopCompleter: always returns an empty list (no
* matches). */
- public string[] NoopCompleter (string text)
+ public void NoopCompleter (string text, int start, int end)
{
- return null;
+ LineReader.SetCompletionMatches (null);
}
- public string[] SymbolCompleter (ScriptingContext context, string text)
+ public void SymbolCompleter (ScriptingContext context, string text, int start, int end)
{
try {
- var method_list = new List<string> ();
+ ArrayList method_list = new ArrayList ();
string[] namespaces = context.GetNamespaces();
Module[] modules = context.CurrentProcess.Modules;
@@ -200,9 +267,17 @@ namespace Mono.Debugger.Frontend
}
}
- return method_list.ToArray ();
+ string[] methods = null;
+ if (method_list.Count > 0) {
+ method_list.Insert (0, ComputeMCP (method_list, text));
+ methods = new string [method_list.Count + 1];
+ method_list.CopyTo (methods);
+ methods [method_list.Count] = null;
+ }
+
+ LineReader.SetCompletionMatches (methods);
} catch {
- return null;
+ LineReader.SetCompletionMatches (null);
}
}
}
diff --git a/frontend/Expression.cs b/frontend/Expression.cs
index 888038a..d61f7cd 100644
--- a/frontend/Expression.cs
+++ b/frontend/Expression.cs
@@ -770,13 +770,7 @@ namespace Mono.Debugger.Frontend
TargetClassObject instance = null;
if (method.HasThis) {
TargetVariable this_var = method.GetThis (context.CurrentThread);
- TargetObject this_obj = this_var.GetObject (frame);
-
- var pobj = this_obj as TargetPointerObject;
- if (pobj != null)
- this_obj = pobj.GetDereferencedObject (context.CurrentThread);
-
- instance = (TargetClassObject) this_obj;
+ instance = (TargetClassObject) this_var.GetObject (frame);
}
member = StructAccessExpression.FindMember (
diff --git a/frontend/GnuReadLine.cs b/frontend/GnuReadLine.cs
new file mode 100644
index 0000000..0d65788
--- /dev/null
+++ b/frontend/GnuReadLine.cs
@@ -0,0 +1,98 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace Mono.Debugger.Frontend
+{
+ public delegate void CompletionDelegate (string text, int start, int end);
+ public delegate string CompletionGenerator (string text, int state);
+
+ internal class GnuReadLine : IReadLine
+ {
+ [DllImport("libmonodebuggerreadline")]
+ extern static void mono_debugger_readline_static_init ();
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static int mono_debugger_readline_is_a_tty (int fd);
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static string mono_debugger_readline_readline (string prompt);
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static void mono_debugger_readline_add_history (string line);
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static void mono_debugger_readline_enable_completion (Delegate handler);
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static string mono_debugger_readline_current_line_buffer ();
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static int mono_debugger_readline_get_columns ();
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static void mono_debugger_readline_set_completion_matches (string[] matches, int count);
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static int mono_debugger_readline_get_filename_completion_desired ();
+
+ [DllImport("libmonodebuggerreadline")]
+ extern static void mono_debugger_readline_set_filename_completion_desired (int v);
+
+ static CompletionDelegate completion_handler;
+
+ static GnuReadLine ()
+ {
+ mono_debugger_readline_static_init ();
+ }
+
+ public bool IsTerminal (int fd)
+ {
+ return mono_debugger_readline_is_a_tty (fd) != 0;
+ }
+
+ public string ReadLine (string prompt)
+ {
+ return mono_debugger_readline_readline (prompt);
+ }
+
+ public void AddHistory (string line)
+ {
+ mono_debugger_readline_add_history (line);
+ }
+
+ public int Columns {
+ get {
+ return mono_debugger_readline_get_columns ();
+ }
+ }
+
+ public void SetCompletionMatches (string[] matches)
+ {
+ mono_debugger_readline_set_completion_matches (matches, matches == null ? 0 : matches.Length);
+ }
+
+ public void EnableCompletion (CompletionDelegate handler)
+ {
+ completion_handler = handler;
+ mono_debugger_readline_enable_completion (completion_handler);
+ }
+
+ public string CurrentLine
+ {
+ get {
+ return mono_debugger_readline_current_line_buffer ();
+ }
+ }
+
+ public bool FilenameCompletionDesired
+ {
+ get {
+ return mono_debugger_readline_get_filename_completion_desired () == 0 ? false : true;
+ }
+ set {
+ mono_debugger_readline_set_filename_completion_desired (value == true ? 1 : 0);
+ }
+ }
+ }
+}
diff --git a/frontend/Interpreter.cs b/frontend/Interpreter.cs
index 8e7b514..2059359 100644
--- a/frontend/Interpreter.cs
+++ b/frontend/Interpreter.cs
@@ -15,6 +15,8 @@ using Mono.Debugger;
using Mono.Debugger.Languages;
using EE=Mono.Debugger.ExpressionEvaluator;
+using Mono.GetOptions;
+
namespace Mono.Debugger.Frontend
{
public class Interpreter : DebuggerMarshalByRefObject, IInterruptionHandler, IDisposable
@@ -320,7 +322,6 @@ namespace Mono.Debugger.Frontend
}
}
-#if DISABLED
public Process OpenCoreFile (string core_file)
{
if ((debugger != null) || (main_process != null))
@@ -346,7 +347,6 @@ namespace Mono.Debugger.Frontend
throw;
}
}
-#endif
public void SaveSession (Stream stream)
{
diff --git a/frontend/LineReader.cs b/frontend/LineReader.cs
new file mode 100644
index 0000000..92eef41
--- /dev/null
+++ b/frontend/LineReader.cs
@@ -0,0 +1,88 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace Mono.Debugger.Frontend
+{
+ internal class LineReader
+ {
+ static IReadLine readline;
+
+ static LineReader () {
+ // Hack for now. Put this check in a better place
+ // where all can access it.
+ if ((int)Environment.OSVersion.Platform < 4)
+ readline = new ManagedReadLine ();
+ else
+ readline = new GnuReadLine ();
+ }
+
+ public static bool IsTerminal (int fd) {
+ return readline.IsTerminal (fd);
+ }
+
+ public static string ReadLine (string prompt) {
+ return readline.ReadLine (prompt);
+ }
+
+ public static void AddHistory (string line) {
+ readline.AddHistory (line);
+ }
+
+ public static int Columns {
+ get {
+ return readline.Columns;
+ }
+ }
+
+ public static void SetCompletionMatches (string[] matches) {
+ readline.SetCompletionMatches (matches);
+ }
+
+ public static void EnableCompletion (CompletionDelegate handler) {
+ readline.EnableCompletion (handler);
+ }
+
+ public static string CurrentLine {
+ get {
+ return readline.CurrentLine;
+ }
+ }
+
+ public static bool FilenameCompletionDesired {
+ get {
+ return readline.FilenameCompletionDesired;
+ }
+ set {
+ readline.FilenameCompletionDesired = value;
+ }
+ }
+ }
+
+ internal interface IReadLine
+ {
+ bool IsTerminal (int fd);
+
+ string ReadLine (string prompt);
+
+ void AddHistory (string line);
+
+ int Columns {
+ get;
+ }
+
+ void SetCompletionMatches (string[] matches);
+
+ void EnableCompletion (CompletionDelegate handler);
+
+ string CurrentLine {
+ get;
+ }
+
+ bool FilenameCompletionDesired {
+ get;
+ set;
+ }
+ }
+}
+
diff --git a/frontend/Main.cs b/frontend/Main.cs
index 4669ff0..e5b5f06 100644
--- a/frontend/Main.cs
+++ b/frontend/Main.cs
@@ -8,8 +8,6 @@ using ST = System.Threading;
using Mono.Debugger;
using Mono.Debugger.Backend;
-using Mono.Terminal;
-
namespace Mono.Debugger.Frontend
{
public class CommandLineInterpreter
@@ -45,15 +43,25 @@ namespace Mono.Debugger.Frontend
int line = 0;
bool is_inferior_main;
+ ST.Thread interrupt_thread;
ST.Thread main_thread;
ST.AutoResetEvent interrupt_event;
ST.AutoResetEvent nested_break_state_event;
- LineEditor line_editor;
-
Stack<CommandLineInterpreter.MainLoop> main_loop_stack;
+ [DllImport("monodebuggerserver")]
+ static extern int mono_debugger_server_static_init ();
+
+ [DllImport("monodebuggerserver")]
+ static extern int mono_debugger_server_get_pending_sigint ();
+
+ static CommandLineInterpreter ()
+ {
+ mono_debugger_server_static_init ();
+ }
+
internal CommandLineInterpreter (DebuggerOptions options, bool is_interactive)
{
if (options.HasDebugFlags)
@@ -79,16 +87,6 @@ namespace Mono.Debugger.Frontend
engine = interpreter.DebuggerEngine;
parser = new LineParser (engine);
- if (!interpreter.IsScript) {
- line_editor = new LineEditor ("mdb");
-
- line_editor.AutoCompleteEvent += delegate (string text, int pos) {
- return engine.Completer.Complete (text, pos);
- };
-
- Console.CancelKeyPress += control_c_event;
- }
-
interrupt_event = new ST.AutoResetEvent (false);
nested_break_state_event = new ST.AutoResetEvent (false);
@@ -97,6 +95,9 @@ namespace Mono.Debugger.Frontend
main_thread = new ST.Thread (new ST.ThreadStart (main_thread_main));
main_thread.IsBackground = true;
+
+ interrupt_thread = new ST.Thread (new ST.ThreadStart (interrupt_thread_main));
+ interrupt_thread.IsBackground = true;
}
public CommandLineInterpreter (Interpreter interpreter)
@@ -110,21 +111,14 @@ namespace Mono.Debugger.Frontend
interrupt_event = new ST.AutoResetEvent (false);
nested_break_state_event = new ST.AutoResetEvent (false);
- Console.CancelKeyPress += control_c_event;
-
main_loop_stack = new Stack<MainLoop> ();
main_loop_stack.Push (new MainLoop (interpreter));
main_thread = new ST.Thread (new ST.ThreadStart (main_thread_main));
main_thread.IsBackground = true;
- }
-
- void control_c_event (object sender, ConsoleCancelEventArgs a)
- {
- a.Cancel = true;
- if (interpreter.Interrupt () > 2)
- interrupt_event.Set ();
+ interrupt_thread = new ST.Thread (new ST.ThreadStart (interrupt_thread_main));
+ interrupt_thread.IsBackground = true;
}
public void DoRunMainLoop ()
@@ -236,6 +230,8 @@ namespace Mono.Debugger.Frontend
{
is_inferior_main = false;
+ interrupt_thread.Start ();
+
try {
if (interpreter.Options.StartTarget)
interpreter.Start ();
@@ -257,6 +253,8 @@ namespace Mono.Debugger.Frontend
{
is_inferior_main = true;
+ interrupt_thread.Start ();
+
TextReader old_stdin = Console.In;
TextWriter old_stdout = Console.Out;
TextWriter old_stderr = Console.Error;
@@ -299,6 +297,8 @@ namespace Mono.Debugger.Frontend
interpreter.IsScript = old_is_script;
interpreter.IsInteractive = old_is_interactive;
}
+
+ interrupt_thread.Abort ();
}
public string ReadInput (bool is_complete)
@@ -310,9 +310,11 @@ namespace Mono.Debugger.Frontend
Console.Write (the_prompt);
return Console.ReadLine ();
} else {
- string result = line_editor.Edit (the_prompt, "");
+ string result = LineReader.ReadLine (the_prompt);
if (result == null)
return null;
+ if (result != "")
+ LineReader.AddHistory (result);
return result;
}
}
@@ -333,13 +335,27 @@ namespace Mono.Debugger.Frontend
}
}
+ void interrupt_thread_main ()
+ {
+ do {
+ Semaphore.Wait ();
+ if (mono_debugger_server_get_pending_sigint () == 0)
+ continue;
+
+ if (interpreter.Interrupt () > 2)
+ interrupt_event.Set ();
+ } while (true);
+ }
+
public static void Main (string[] args)
{
+ bool is_terminal = LineReader.IsTerminal (0);
+
DebuggerOptions options = DebuggerOptions.ParseCommandLine (args);
Console.WriteLine ("Mono Debugger");
- CommandLineInterpreter interpreter = new CommandLineInterpreter (options, true);
+ CommandLineInterpreter interpreter = new CommandLineInterpreter (options, is_terminal);
interpreter.RunMainLoop ();
diff --git a/frontend/Makefile.am b/frontend/Makefile.am
index c3267aa..28f0802 100644
--- a/frontend/Makefile.am
+++ b/frontend/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = jay
+SUBDIRS = jay libedit
noinst_DATA = CSharpExpressionParser.cs
diff --git a/frontend/Makefile.in b/frontend/Makefile.in
index c28c04c..db45e75 100644
--- a/frontend/Makefile.in
+++ b/frontend/Makefile.in
@@ -131,6 +131,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
@@ -209,7 +210,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = jay
+SUBDIRS = jay libedit
noinst_DATA = CSharpExpressionParser.cs
JAY = jay/jay
CSLEX = $(top_builddir)/cslex/cslex.exe
diff --git a/frontend/ManagedReadLine.cs b/frontend/ManagedReadLine.cs
new file mode 100644
index 0000000..374efad
--- /dev/null
+++ b/frontend/ManagedReadLine.cs
@@ -0,0 +1,57 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+
+namespace Mono.Debugger.Frontend
+{
+ internal class ManagedReadLine : IReadLine
+ {
+ Stack<string> history = new Stack<string> ();
+ string current_line = string.Empty;
+
+ public bool IsTerminal (int fd) {
+ return false;
+ }
+
+ public string ReadLine (string prompt) {
+ Console.Write (prompt);
+ current_line = Console.ReadLine ();
+ return current_line;
+ }
+
+ public void AddHistory (string line) {
+ history.Push (line);
+ }
+
+ public int Columns {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public void SetCompletionMatches (string[] matches) {
+ throw new NotImplementedException ();
+ }
+
+ public void EnableCompletion (CompletionDelegate handler) {
+ throw new NotImplementedException ();
+ }
+
+ public string CurrentLine {
+ get {
+ return current_line;
+ }
+ }
+
+ public bool FilenameCompletionDesired {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+
diff --git a/frontend/ScriptingContext.cs b/frontend/ScriptingContext.cs
index 814f709..7ffc937 100644
--- a/frontend/ScriptingContext.cs
+++ b/frontend/ScriptingContext.cs
@@ -12,6 +12,8 @@ using Mono.Debugger;
using Mono.Debugger.Languages;
using EE = Mono.Debugger.ExpressionEvaluator;
+using Mono.GetOptions;
+
namespace Mono.Debugger.Frontend
{
public class ScriptingException : Exception
diff --git a/frontend/getline.cs b/frontend/getline.cs
deleted file mode 100644
index c9cd997..0000000
--- a/frontend/getline.cs
+++ /dev/null
@@ -1,1086 +0,0 @@
-//
-// getline.cs: A command line editor
-//
-// Authors:
-// Miguel de Icaza (miguel at novell.com)
-//
-// Copyright 2008 Novell, Inc.
-//
-// Dual-licensed under the terms of the MIT X11 license or the
-// Apache License 2.0
-//
-// USE -define:DEMO to build this as a standalone file and test it
-//
-// TODO:
-// Enter an error (a = 1); Notice how the prompt is in the wrong line
-// This is caused by Stderr not being tracked by System.Console.
-// Completion support
-// Why is Thread.Interrupt not working? Currently I resort to Abort which is too much.
-//
-// Limitations in System.Console:
-// Console needs SIGWINCH support of some sort
-// Console needs a way of updating its position after things have been written
-// behind its back (P/Invoke puts for example).
-// System.Console needs to get the DELETE character, and report accordingly.
-//
-#if NET_2_0 || NET_1_1
-#define IN_MCS_BUILD
-#endif
-
-// Only compile this code in the 2.0 profile, but not in the Moonlight one
-#if (IN_MCS_BUILD && NET_2_0 && !SMCS_SOURCE) || !IN_MCS_BUILD
-using System;
-using System.Text;
-using System.IO;
-using System.Threading;
-using System.Reflection;
-
-namespace Mono.Terminal {
-
- public class LineEditor {
-
- public class Completion {
- public string [] Result;
- public string Prefix;
-
- public Completion (string prefix, string [] result)
- {
- Prefix = prefix;
- Result = result;
- }
- }
-
- public delegate Completion AutoCompleteHandler (string text, int pos);
-
- //static StreamWriter log;
-
- // The text being edited.
- StringBuilder text;
-
- // The text as it is rendered (replaces (char)1 with ^A on display for example).
- StringBuilder rendered_text;
-
- // The prompt specified, and the prompt shown to the user.
- string prompt;
- string shown_prompt;
-
- // The current cursor position, indexes into "text", for an index
- // into rendered_text, use TextToRenderPos
- int cursor;
-
- // The row where we started displaying data.
- int home_row;
-
- // The maximum length that has been displayed on the screen
- int max_rendered;
-
- // If we are done editing, this breaks the interactive loop
- bool done = false;
-
- // The thread where the Editing started taking place
- Thread edit_thread;
-
- // Our object that tracks history
- History history;
-
- // The contents of the kill buffer (cut/paste in Emacs parlance)
- string kill_buffer = "";
-
- // The string being searched for
- string search;
- string last_search;
-
- // whether we are searching (-1= reverse; 0 = no; 1 = forward)
- int searching;
-
- // The position where we found the match.
- int match_at;
-
- // Used to implement the Kill semantics (multiple Alt-Ds accumulate)
- KeyHandler last_handler;
-
- delegate void KeyHandler ();
-
- struct Handler {
- public ConsoleKeyInfo CKI;
- public KeyHandler KeyHandler;
-
- public Handler (ConsoleKey key, KeyHandler h)
- {
- CKI = new ConsoleKeyInfo ((char) 0, key, false, false, false);
- KeyHandler = h;
- }
-
- public Handler (char c, KeyHandler h)
- {
- KeyHandler = h;
- // Use the "Zoom" as a flag that we only have a character.
- CKI = new ConsoleKeyInfo (c, ConsoleKey.Zoom, false, false, false);
- }
-
- public Handler (ConsoleKeyInfo cki, KeyHandler h)
- {
- CKI = cki;
- KeyHandler = h;
- }
-
- public static Handler Control (char c, KeyHandler h)
- {
- return new Handler ((char) (c - 'A' + 1), h);
- }
-
- public static Handler Alt (char c, ConsoleKey k, KeyHandler h)
- {
- ConsoleKeyInfo cki = new ConsoleKeyInfo ((char) c, k, false, true, false);
- return new Handler (cki, h);
- }
- }
-
- /// <summary>
- /// Invoked when the user requests auto-completion using the tab character
- /// </summary>
- /// <remarks>
- /// The result is null for no values found, an array with a single
- /// string, in that case the string should be the text to be inserted
- /// for example if the word at pos is "T", the result for a completion
- /// of "ToString" should be "oString", not "ToString".
- ///
- /// When there are multiple results, the result should be the full
- /// text
- /// </remarks>
- public AutoCompleteHandler AutoCompleteEvent;
-
- static Handler [] handlers;
-
- public LineEditor (string name) : this (name, 10) { }
-
- public LineEditor (string name, int histsize)
- {
- handlers = new Handler [] {
- new Handler (ConsoleKey.Home, CmdHome),
- new Handler (ConsoleKey.End, CmdEnd),
- new Handler (ConsoleKey.LeftArrow, CmdLeft),
- new Handler (ConsoleKey.RightArrow, CmdRight),
- new Handler (ConsoleKey.UpArrow, CmdHistoryPrev),
- new Handler (ConsoleKey.DownArrow, CmdHistoryNext),
- new Handler (ConsoleKey.Enter, CmdDone),
- new Handler (ConsoleKey.Backspace, CmdBackspace),
- new Handler (ConsoleKey.Delete, CmdDeleteChar),
- new Handler (ConsoleKey.Tab, CmdTabOrComplete),
-
- // Emacs keys
- Handler.Control ('A', CmdHome),
- Handler.Control ('E', CmdEnd),
- Handler.Control ('B', CmdLeft),
- Handler.Control ('F', CmdRight),
- Handler.Control ('P', CmdHistoryPrev),
- Handler.Control ('N', CmdHistoryNext),
- Handler.Control ('K', CmdKillToEOF),
- Handler.Control ('Y', CmdYank),
- Handler.Control ('D', CmdDeleteChar),
- Handler.Control ('L', CmdRefresh),
- Handler.Control ('R', CmdReverseSearch),
- Handler.Control ('G', delegate {} ),
- Handler.Alt ('B', ConsoleKey.B, CmdBackwardWord),
- Handler.Alt ('F', ConsoleKey.F, CmdForwardWord),
-
- Handler.Alt ('D', ConsoleKey.D, CmdDeleteWord),
- Handler.Alt ((char) 8, ConsoleKey.Backspace, CmdDeleteBackword),
-
- // DEBUG
- //Handler.Control ('T', CmdDebug),
-
- // quote
- Handler.Control ('Q', delegate { HandleChar (Console.ReadKey (true).KeyChar); })
- };
-
- rendered_text = new StringBuilder ();
- text = new StringBuilder ();
-
- history = new History (name, histsize);
-
- //if (File.Exists ("log"))File.Delete ("log");
- //log = File.CreateText ("log");
- }
-
- void CmdDebug ()
- {
- history.Dump ();
- Console.WriteLine ();
- Render ();
- }
-
- void Render ()
- {
- Console.Write (shown_prompt);
- Console.Write (rendered_text);
-
- int max = System.Math.Max (rendered_text.Length + shown_prompt.Length, max_rendered);
-
- for (int i = rendered_text.Length + shown_prompt.Length; i < max_rendered; i++)
- Console.Write (' ');
- max_rendered = shown_prompt.Length + rendered_text.Length;
-
- // Write one more to ensure that we always wrap around properly if we are at the
- // end of a line.
- Console.Write (' ');
-
- UpdateHomeRow (max);
- }
-
- void UpdateHomeRow (int screenpos)
- {
- int lines = 1 + (screenpos / Console.WindowWidth);
-
- home_row = Console.CursorTop - (lines - 1);
- if (home_row < 0)
- home_row = 0;
- }
-
-
- void RenderFrom (int pos)
- {
- int rpos = TextToRenderPos (pos);
- int i;
-
- for (i = rpos; i < rendered_text.Length; i++)
- Console.Write (rendered_text [i]);
-
- if ((shown_prompt.Length + rendered_text.Length) > max_rendered)
- max_rendered = shown_prompt.Length + rendered_text.Length;
- else {
- int max_extra = max_rendered - shown_prompt.Length;
- for (; i < max_extra; i++)
- Console.Write (' ');
- }
- }
-
- void ComputeRendered ()
- {
- rendered_text.Length = 0;
-
- for (int i = 0; i < text.Length; i++){
- int c = (int) text [i];
- if (c < 26){
- if (c == '\t')
- rendered_text.Append (" ");
- else {
- rendered_text.Append ('^');
- rendered_text.Append ((char) (c + (int) 'A' - 1));
- }
- } else
- rendered_text.Append ((char)c);
- }
- }
-
- int TextToRenderPos (int pos)
- {
- int p = 0;
-
- for (int i = 0; i < pos; i++){
- int c;
-
- c = (int) text [i];
-
- if (c < 26){
- if (c == 9)
- p += 4;
- else
- p += 2;
- } else
- p++;
- }
-
- return p;
- }
-
- int TextToScreenPos (int pos)
- {
- return shown_prompt.Length + TextToRenderPos (pos);
- }
-
- string Prompt {
- get { return prompt; }
- set { prompt = value; }
- }
-
- int LineCount {
- get {
- return (shown_prompt.Length + rendered_text.Length)/Console.WindowWidth;
- }
- }
-
- void ForceCursor (int newpos)
- {
- cursor = newpos;
-
- int actual_pos = shown_prompt.Length + TextToRenderPos (cursor);
- int row = home_row + (actual_pos/Console.WindowWidth);
- int col = actual_pos % Console.WindowWidth;
-
- if (row >= Console.BufferHeight)
- row = Console.BufferHeight-1;
- Console.SetCursorPosition (col, row);
-
- //log.WriteLine ("Going to cursor={0} row={1} col={2} actual={3} prompt={4} ttr={5} old={6}", newpos, row, col, actual_pos, prompt.Length, TextToRenderPos (cursor), cursor);
- //log.Flush ();
- }
-
- void UpdateCursor (int newpos)
- {
- if (cursor == newpos)
- return;
-
- ForceCursor (newpos);
- }
-
- void InsertChar (char c)
- {
- int prev_lines = LineCount;
- text = text.Insert (cursor, c);
- ComputeRendered ();
- if (prev_lines != LineCount){
-
- Console.SetCursorPosition (0, home_row);
- Render ();
- ForceCursor (++cursor);
- } else {
- RenderFrom (cursor);
- ForceCursor (++cursor);
- UpdateHomeRow (TextToScreenPos (cursor));
- }
- }
-
- //
- // Commands
- //
- void CmdDone ()
- {
- done = true;
- }
-
- void CmdTabOrComplete ()
- {
- bool complete = false;
-
- if (AutoCompleteEvent != null){
- if (TabAtStartCompletes)
- complete = true;
- else {
- for (int i = 0; i < cursor; i++){
- if (!Char.IsWhiteSpace (text [i])){
- complete = true;
- break;
- }
- }
- }
-
- if (complete){
- Completion completion = AutoCompleteEvent (text.ToString (), cursor);
- if (completion == null)
- return;
- string [] completions = completion.Result;
- if (completions == null)
- return;
-
- int ncompletions = completions.Length;
- if (ncompletions == 0)
- return;
-
- if (completions.Length == 1){
- InsertTextAtCursor (completions [0]);
- } else {
- int last = -1;
-
- for (int p = 0; p < completions [0].Length; p++){
- char c = completions [0][p];
-
-
- for (int i = 1; i < ncompletions; i++){
- if (completions [i].Length < p)
- goto mismatch;
-
- if (completions [i][p] != c){
- goto mismatch;
- }
- }
- last = p;
- }
- mismatch:
- if (last != -1){
- InsertTextAtCursor (completions [0].Substring (0, last+1));
- }
- Console.WriteLine ();
- foreach (string s in completions){
- Console.Write (completion.Prefix);
- Console.Write (s);
- Console.Write (' ');
- }
- Console.WriteLine ();
- Render ();
- ForceCursor (cursor);
- }
- } else
- HandleChar ('\t');
- } else
- HandleChar ('t');
- }
-
- void CmdHome ()
- {
- UpdateCursor (0);
- }
-
- void CmdEnd ()
- {
- UpdateCursor (text.Length);
- }
-
- void CmdLeft ()
- {
- if (cursor == 0)
- return;
-
- UpdateCursor (cursor-1);
- }
-
- void CmdBackwardWord ()
- {
- int p = WordBackward (cursor);
- if (p == -1)
- return;
- UpdateCursor (p);
- }
-
- void CmdForwardWord ()
- {
- int p = WordForward (cursor);
- if (p == -1)
- return;
- UpdateCursor (p);
- }
-
- void CmdRight ()
- {
- if (cursor == text.Length)
- return;
-
- UpdateCursor (cursor+1);
- }
-
- void RenderAfter (int p)
- {
- ForceCursor (p);
- RenderFrom (p);
- ForceCursor (cursor);
- }
-
- void CmdBackspace ()
- {
- if (cursor == 0)
- return;
-
- text.Remove (--cursor, 1);
- ComputeRendered ();
- RenderAfter (cursor);
- }
-
- void CmdDeleteChar ()
- {
- // If there is no input, this behaves like EOF
- if (text.Length == 0){
- done = true;
- text = null;
- Console.WriteLine ();
- return;
- }
-
- if (cursor == text.Length)
- return;
- text.Remove (cursor, 1);
- ComputeRendered ();
- RenderAfter (cursor);
- }
-
- int WordForward (int p)
- {
- if (p >= text.Length)
- return -1;
-
- int i = p;
- if (Char.IsPunctuation (text [p]) || Char.IsWhiteSpace (text[p])){
- for (; i < text.Length; i++){
- if (Char.IsLetterOrDigit (text [i]))
- break;
- }
- for (; i < text.Length; i++){
- if (!Char.IsLetterOrDigit (text [i]))
- break;
- }
- } else {
- for (; i < text.Length; i++){
- if (!Char.IsLetterOrDigit (text [i]))
- break;
- }
- }
- if (i != p)
- return i;
- return -1;
- }
-
- int WordBackward (int p)
- {
- if (p == 0)
- return -1;
-
- int i = p-1;
- if (i == 0)
- return 0;
-
- if (Char.IsPunctuation (text [i]) || Char.IsSymbol (text [i]) || Char.IsWhiteSpace (text[i])){
- for (; i >= 0; i--){
- if (Char.IsLetterOrDigit (text [i]))
- break;
- }
- for (; i >= 0; i--){
- if (!Char.IsLetterOrDigit (text[i]))
- break;
- }
- } else {
- for (; i >= 0; i--){
- if (!Char.IsLetterOrDigit (text [i]))
- break;
- }
- }
- i++;
-
- if (i != p)
- return i;
-
- return -1;
- }
-
- void CmdDeleteWord ()
- {
- int pos = WordForward (cursor);
-
- if (pos == -1)
- return;
-
- string k = text.ToString (cursor, pos-cursor);
-
- if (last_handler == CmdDeleteWord)
- kill_buffer = kill_buffer + k;
- else
- kill_buffer = k;
-
- text.Remove (cursor, pos-cursor);
- ComputeRendered ();
- RenderAfter (cursor);
- }
-
- void CmdDeleteBackword ()
- {
- int pos = WordBackward (cursor);
- if (pos == -1)
- return;
-
- string k = text.ToString (pos, cursor-pos);
-
- if (last_handler == CmdDeleteBackword)
- kill_buffer = k + kill_buffer;
- else
- kill_buffer = k;
-
- text.Remove (pos, cursor-pos);
- ComputeRendered ();
- RenderAfter (pos);
- }
-
- //
- // Adds the current line to the history if needed
- //
- void HistoryUpdateLine ()
- {
- history.Update (text.ToString ());
- }
-
- void CmdHistoryPrev ()
- {
- if (!history.PreviousAvailable ())
- return;
-
- HistoryUpdateLine ();
-
- SetText (history.Previous ());
- }
-
- void CmdHistoryNext ()
- {
- if (!history.NextAvailable())
- return;
-
- history.Update (text.ToString ());
- SetText (history.Next ());
-
- }
-
- void CmdKillToEOF ()
- {
- kill_buffer = text.ToString (cursor, text.Length-cursor);
- text.Length = cursor;
- ComputeRendered ();
- RenderAfter (cursor);
- }
-
- void CmdYank ()
- {
- InsertTextAtCursor (kill_buffer);
- }
-
- void InsertTextAtCursor (string str)
- {
- int prev_lines = LineCount;
- text.Insert (cursor, str);
- ComputeRendered ();
- if (prev_lines != LineCount){
- Console.SetCursorPosition (0, home_row);
- Render ();
- cursor += str.Length;
- ForceCursor (cursor);
- } else {
- RenderFrom (cursor);
- cursor += str.Length;
- ForceCursor (cursor);
- UpdateHomeRow (TextToScreenPos (cursor));
- }
- }
-
- void SetSearchPrompt (string s)
- {
- SetPrompt ("(reverse-i-search)`" + s + "': ");
- }
-
- void ReverseSearch ()
- {
- int p;
-
- if (cursor == text.Length){
- // The cursor is at the end of the string
-
- p = text.ToString ().LastIndexOf (search);
- if (p != -1){
- match_at = p;
- cursor = p;
- ForceCursor (cursor);
- return;
- }
- } else {
- // The cursor is somewhere in the middle of the string
- int start = (cursor == match_at) ? cursor - 1 : cursor;
- if (start != -1){
- p = text.ToString ().LastIndexOf (search, start);
- if (p != -1){
- match_at = p;
- cursor = p;
- ForceCursor (cursor);
- return;
- }
- }
- }
-
- // Need to search backwards in history
- HistoryUpdateLine ();
- string s = history.SearchBackward (search);
- if (s != null){
- match_at = -1;
- SetText (s);
- ReverseSearch ();
- }
- }
-
- void CmdReverseSearch ()
- {
- if (searching == 0){
- match_at = -1;
- last_search = search;
- searching = -1;
- search = "";
- SetSearchPrompt ("");
- } else {
- if (search == ""){
- if (last_search != "" && last_search != null){
- search = last_search;
- SetSearchPrompt (search);
-
- ReverseSearch ();
- }
- return;
- }
- ReverseSearch ();
- }
- }
-
- void SearchAppend (char c)
- {
- search = search + c;
- SetSearchPrompt (search);
-
- //
- // If the new typed data still matches the current text, stay here
- //
- if (cursor < text.Length){
- string r = text.ToString (cursor, text.Length - cursor);
- if (r.StartsWith (search))
- return;
- }
-
- ReverseSearch ();
- }
-
- void CmdRefresh ()
- {
- Console.Clear ();
- max_rendered = 0;
- Render ();
- ForceCursor (cursor);
- }
-
- void InterruptEdit (object sender, ConsoleCancelEventArgs a)
- {
- // Do not abort our program:
- a.Cancel = true;
-
- // Interrupt the editor
- edit_thread.Abort();
- }
-
- void HandleChar (char c)
- {
- if (searching != 0)
- SearchAppend (c);
- else
- InsertChar (c);
- }
-
- void EditLoop ()
- {
- ConsoleKeyInfo cki;
-
- while (!done){
- ConsoleModifiers mod;
-
- cki = Console.ReadKey (true);
- if (cki.Key == ConsoleKey.Escape){
- cki = Console.ReadKey (true);
-
- mod = ConsoleModifiers.Alt;
- } else
- mod = cki.Modifiers;
-
- bool handled = false;
-
- foreach (Handler handler in handlers){
- ConsoleKeyInfo t = handler.CKI;
-
- if (t.Key == cki.Key && t.Modifiers == mod){
- handled = true;
- handler.KeyHandler ();
- last_handler = handler.KeyHandler;
- break;
- } else if (t.KeyChar == cki.KeyChar && t.Key == ConsoleKey.Zoom){
- handled = true;
- handler.KeyHandler ();
- last_handler = handler.KeyHandler;
- break;
- }
- }
- if (handled){
- if (searching != 0){
- if (last_handler != CmdReverseSearch){
- searching = 0;
- SetPrompt (prompt);
- }
- }
- continue;
- }
-
- if (cki.KeyChar != (char) 0)
- HandleChar (cki.KeyChar);
- }
- }
-
- void InitText (string initial)
- {
- text = new StringBuilder (initial);
- ComputeRendered ();
- cursor = text.Length;
- Render ();
- ForceCursor (cursor);
- }
-
- void SetText (string newtext)
- {
- Console.SetCursorPosition (0, home_row);
- InitText (newtext);
- }
-
- void SetPrompt (string newprompt)
- {
- shown_prompt = newprompt;
- Console.SetCursorPosition (0, home_row);
- Render ();
- ForceCursor (cursor);
- }
-
- public string Edit (string prompt, string initial)
- {
- edit_thread = Thread.CurrentThread;
- searching = 0;
- Console.CancelKeyPress += InterruptEdit;
-
- home_row = Console.CursorTop;
-
- done = false;
- history.CursorToEnd ();
- max_rendered = 0;
-
- Prompt = prompt;
- shown_prompt = prompt;
- InitText (initial);
- history.Append (initial);
-
- do {
- try {
- EditLoop ();
- } catch (ThreadAbortException){
- searching = 0;
- Thread.ResetAbort ();
- Console.WriteLine ();
- SetPrompt (prompt);
- SetText ("");
- }
- } while (!done);
- Console.WriteLine ();
-
- Console.CancelKeyPress -= InterruptEdit;
-
- if (text == null){
- history.Close ();
- return null;
- }
-
- string result = text.ToString ();
- if (result != "")
- history.Accept (result);
- else
- history.RemoveLast ();
-
- return result;
- }
-
- public bool TabAtStartCompletes { get; set; }
-
- //
- // Emulates the bash-like behavior, where edits done to the
- // history are recorded
- //
- class History {
- string [] history;
- int head, tail;
- int cursor, count;
- string histfile;
-
- public History (string app, int size)
- {
- if (size < 1)
- throw new ArgumentException ("size");
-
- if (app != null){
- string dir = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
- //Console.WriteLine (dir);
- if (!Directory.Exists (dir)){
- try {
- Directory.CreateDirectory (dir);
- } catch {
- app = null;
- }
- }
- if (app != null)
- histfile = Path.Combine (dir, app) + ".history";
- }
-
- history = new string [size];
- head = tail = cursor = 0;
-
- if (File.Exists (histfile)){
- using (StreamReader sr = File.OpenText (histfile)){
- string line;
-
- while ((line = sr.ReadLine ()) != null){
- if (line != "")
- Append (line);
- }
- }
- }
- }
-
- public void Close ()
- {
- if (histfile == null)
- return;
-
- try {
- using (StreamWriter sw = File.CreateText (histfile)){
- int start = (count == history.Length) ? head : tail;
- for (int i = start; i < start+count; i++){
- int p = i % history.Length;
- sw.WriteLine (history [p]);
- }
- }
- } catch {
- // ignore
- }
- }
-
- //
- // Appends a value to the history
- //
- public void Append (string s)
- {
- //Console.WriteLine ("APPENDING {0} {1}", s, Environment.StackTrace);
- history [head] = s;
- head = (head+1) % history.Length;
- if (head == tail)
- tail = (tail+1 % history.Length);
- if (count != history.Length)
- count++;
- }
-
- //
- // Updates the current cursor location with the string,
- // to support editing of history items. For the current
- // line to participate, an Append must be done before.
- //
- public void Update (string s)
- {
- history [cursor] = s;
- }
-
- public void RemoveLast ()
- {
- head = head-1;
- if (head < 0)
- head = history.Length-1;
- }
-
- public void Accept (string s)
- {
- int t = head-1;
- if (t < 0)
- t = history.Length-1;
-
- history [t] = s;
- }
-
- public bool PreviousAvailable ()
- {
- //Console.WriteLine ("h={0} t={1} cursor={2}", head, tail, cursor);
- if (count == 0 || cursor == tail)
- return false;
-
- return true;
- }
-
- public bool NextAvailable ()
- {
- int next = (cursor + 1) % history.Length;
- if (count == 0 || next >= head)
- return false;
-
- return true;
- }
-
-
- //
- // Returns: a string with the previous line contents, or
- // nul if there is no data in the history to move to.
- //
- public string Previous ()
- {
- if (!PreviousAvailable ())
- return null;
-
- cursor--;
- if (cursor < 0)
- cursor = history.Length - 1;
-
- return history [cursor];
- }
-
- public string Next ()
- {
- if (!NextAvailable ())
- return null;
-
- cursor = (cursor + 1) % history.Length;
- return history [cursor];
- }
-
- public void CursorToEnd ()
- {
- if (head == tail)
- return;
-
- cursor = head;
- }
-
- public void Dump ()
- {
- Console.WriteLine ("Head={0} Tail={1} Cursor={2}", head, tail, cursor);
- for (int i = 0; i < history.Length;i++){
- Console.WriteLine (" {0} {1}: {2}", i == cursor ? "==>" : " ", i, history[i]);
- }
- //log.Flush ();
- }
-
- public string SearchBackward (string term)
- {
- for (int i = 1; i < count; i++){
- int slot = cursor-i;
- if (slot < 0)
- slot = history.Length-1;
- if (history [slot] != null && history [slot].IndexOf (term) != -1){
- cursor = slot;
- return history [slot];
- }
-
- // Will the next hit tail?
- slot--;
- if (slot < 0)
- slot = history.Length-1;
- if (slot == tail)
- break;
- }
-
- return null;
- }
-
- }
- }
-
-#if DEMO
- class Demo {
- static void Main ()
- {
- LineEditor le = new LineEditor (null);
- string s;
-
- while ((s = le.Edit ("shell> ", "")) != null){
- Console.WriteLine ("----> [{0}]", s);
- }
- }
- }
-#endif
-}
-#endif
diff --git a/frontend/jay/Makefile.in b/frontend/jay/Makefile.in
index 0478f8d..27b1201 100644
--- a/frontend/jay/Makefile.in
+++ b/frontend/jay/Makefile.in
@@ -141,6 +141,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/frontend/jay/closure.c b/frontend/jay/closure.c
index 57e17fd..5f63c5f 100644
--- a/frontend/jay/closure.c
+++ b/frontend/jay/closure.c
@@ -48,7 +48,6 @@ static unsigned *first_derives;
static unsigned *EFF;
-void
set_EFF()
{
register unsigned *row;
@@ -85,7 +84,6 @@ set_EFF()
}
-void
set_first_derives()
{
register unsigned *rrow;
@@ -141,7 +139,6 @@ set_first_derives()
}
-void
closure(nucleus, n)
short *nucleus;
int n;
@@ -212,7 +209,6 @@ int n;
-void
finalize_closure()
{
FREE(itemset);
@@ -223,7 +219,6 @@ finalize_closure()
#ifdef DEBUG
-void
print_closure(n)
int n;
{
@@ -235,7 +230,6 @@ int n;
}
-void
print_EFF()
{
register int i, j;
@@ -267,7 +261,6 @@ print_EFF()
}
-void
print_first_derives()
{
register int i;
diff --git a/frontend/jay/error.c b/frontend/jay/error.c
index 58e4726..283806c 100644
--- a/frontend/jay/error.c
+++ b/frontend/jay/error.c
@@ -43,7 +43,6 @@ static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
#include "defs.h"
-void
fatal(msg)
char *msg;
{
@@ -52,7 +51,6 @@ char *msg;
}
-void
no_space()
{
fprintf(stderr, "%s: f - out of space\n", myname);
@@ -60,7 +58,6 @@ no_space()
}
-void
open_error(filename)
char *filename;
{
@@ -69,7 +66,6 @@ char *filename;
}
-void
unexpected_EOF()
{
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
@@ -105,7 +101,6 @@ char *st_cptr;
}
-void
syntax_error(st_lineno, st_line, st_cptr)
int st_lineno;
char *st_line;
@@ -118,7 +113,6 @@ char *st_cptr;
}
-void
unterminated_comment(c_lineno, c_line, c_cptr)
int c_lineno;
char *c_line;
@@ -131,7 +125,6 @@ char *c_cptr;
}
-void
unterminated_string(s_lineno, s_line, s_cptr)
int s_lineno;
char *s_line;
@@ -144,7 +137,6 @@ char *s_cptr;
}
-void
unterminated_text(t_lineno, t_line, t_cptr)
int t_lineno;
char *t_line;
@@ -157,7 +149,6 @@ char *t_cptr;
}
-void
illegal_tag(t_lineno, t_line, t_cptr)
int t_lineno;
char *t_line;
@@ -170,7 +161,6 @@ char *t_cptr;
}
-void
illegal_character(c_cptr)
char *c_cptr;
{
@@ -181,7 +171,6 @@ char *c_cptr;
}
-void
used_reserved(s)
char *s;
{
@@ -191,7 +180,6 @@ char *s;
}
-void
tokenized_start(s)
char *s;
{
@@ -201,7 +189,6 @@ declared to be a token\n", myname, lineno, input_file_name, s);
}
-void
retyped_warning(s)
char *s;
{
@@ -210,7 +197,6 @@ redeclared\n", myname, lineno, input_file_name, s);
}
-void
reprec_warning(s)
char *s;
{
@@ -219,7 +205,6 @@ redeclared\n", myname, lineno, input_file_name, s);
}
-void
revalued_warning(s)
char *s;
{
@@ -228,7 +213,6 @@ redeclared\n", myname, lineno, input_file_name, s);
}
-void
terminal_start(s)
char *s;
{
@@ -238,7 +222,6 @@ token\n", myname, lineno, input_file_name, s);
}
-void
restarted_warning()
{
fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
@@ -246,7 +229,6 @@ redeclared\n", myname, lineno, input_file_name);
}
-void
no_grammar()
{
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
@@ -255,7 +237,6 @@ specified\n", myname, lineno, input_file_name);
}
-void
terminal_lhs(s_lineno)
int s_lineno;
{
@@ -265,7 +246,6 @@ of a production\n", myname, s_lineno, input_file_name);
}
-void
prec_redeclared()
{
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
@@ -273,7 +253,6 @@ specifiers\n", myname, lineno, input_file_name);
}
-void
unterminated_action(a_lineno, a_line, a_cptr)
int a_lineno;
char *a_line;
@@ -286,7 +265,6 @@ char *a_cptr;
}
-void
dollar_warning(a_lineno, i)
int a_lineno;
int i;
@@ -296,7 +274,6 @@ end of the current rule\n", myname, a_lineno, input_file_name, i);
}
-void
dollar_error(a_lineno, a_line, a_cptr)
int a_lineno;
char *a_line;
@@ -309,7 +286,6 @@ char *a_cptr;
}
-void
untyped_lhs()
{
fprintf(stderr, "%s: w - line %d of \"%s\", $$ is untyped\n",
@@ -318,7 +294,6 @@ untyped_lhs()
}
-void
untyped_rhs(i, s)
int i;
char *s;
@@ -329,7 +304,6 @@ char *s;
}
-void
unknown_rhs(i)
int i;
{
@@ -339,7 +313,6 @@ int i;
}
-void
default_action_warning()
{
fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
@@ -347,7 +320,6 @@ undefined value to $$\n", myname, lineno, input_file_name);
}
-void
undefined_goal(s)
char *s;
{
@@ -356,7 +328,6 @@ char *s;
}
-void
undefined_symbol_warning(s)
char *s;
{
diff --git a/frontend/jay/lalr.c b/frontend/jay/lalr.c
index d225636..bf9aec8 100644
--- a/frontend/jay/lalr.c
+++ b/frontend/jay/lalr.c
@@ -74,7 +74,6 @@ static short *VERTICES;
static int top;
-void
lalr()
{
tokensetsize = WORDSIZE(ntokens);
@@ -94,7 +93,6 @@ lalr()
-void
set_state_table()
{
register core *sp;
@@ -106,7 +104,6 @@ set_state_table()
-void
set_accessing_symbol()
{
register core *sp;
@@ -118,7 +115,6 @@ set_accessing_symbol()
-void
set_shift_table()
{
register shifts *sp;
@@ -130,7 +126,6 @@ set_shift_table()
-void
set_reduction_table()
{
register reductions *rp;
@@ -142,7 +137,6 @@ set_reduction_table()
-void
set_maxrhs()
{
register short *itemp;
@@ -171,7 +165,6 @@ set_maxrhs()
-void
initialize_LA()
{
register int i, j, k;
@@ -209,7 +202,6 @@ initialize_LA()
}
-void
set_goto_map()
{
register shifts *sp;
@@ -304,13 +296,10 @@ int symbol;
else
high = middle - 1;
}
- /*NOTREACHED*/
- return (-1);
}
-void
initialize_F()
{
register int i;
@@ -388,7 +377,6 @@ initialize_F()
-void
build_relations()
{
register int i;
@@ -481,7 +469,6 @@ build_relations()
}
-void
add_lookback_edge(stateno, ruleno, gotono)
int stateno, ruleno, gotono;
{
@@ -567,14 +554,12 @@ int n;
-void
compute_FOLLOWS()
{
digraph(includes);
}
-void
compute_lookaheads()
{
register int i, n;
@@ -609,7 +594,6 @@ compute_lookaheads()
}
-void
digraph(relation)
short **relation;
{
@@ -637,7 +621,6 @@ short **relation;
-void
traverse(i)
register int i;
{
diff --git a/frontend/jay/lr0.c b/frontend/jay/lr0.c
index aa52e56..43106ea 100644
--- a/frontend/jay/lr0.c
+++ b/frontend/jay/lr0.c
@@ -69,7 +69,6 @@ static short **kernel_end;
static short *kernel_items;
-void
allocate_itemsets()
{
register short *itemp;
@@ -112,7 +111,6 @@ allocate_itemsets()
}
-void
allocate_storage()
{
allocate_itemsets();
@@ -122,7 +120,6 @@ allocate_storage()
}
-void
append_states()
{
register int i;
@@ -152,7 +149,6 @@ append_states()
}
-void
free_storage()
{
FREE(shift_symbol);
@@ -166,7 +162,6 @@ free_storage()
-void
generate_states()
{
allocate_storage();
@@ -259,7 +254,6 @@ int symbol;
-void
initialize_states()
{
register int i;
@@ -287,7 +281,6 @@ initialize_states()
}
-void
new_itemsets()
{
register int i;
@@ -365,7 +358,6 @@ int symbol;
/* show_cores is used for debugging */
-void
show_cores()
{
core *p;
@@ -401,7 +393,6 @@ show_cores()
/* show_ritems is used for debugging */
-void
show_ritems()
{
int i;
@@ -412,7 +403,6 @@ show_ritems()
/* show_rrhs is used for debugging */
-void
show_rrhs()
{
int i;
@@ -424,7 +414,6 @@ show_rrhs()
/* show_shifts is used for debugging */
-void
show_shifts()
{
shifts *p;
@@ -443,7 +432,6 @@ show_shifts()
}
-void
save_shifts()
{
register shifts *p;
@@ -478,7 +466,6 @@ save_shifts()
-void
save_reductions()
{
register short *isp;
@@ -528,7 +515,6 @@ save_reductions()
}
-void
set_derives()
{
register int i, k;
@@ -559,7 +545,6 @@ set_derives()
#endif
}
-void
free_derives()
{
FREE(derives[start_symbol]);
@@ -567,7 +552,6 @@ free_derives()
}
#ifdef DEBUG
-void
print_derives()
{
register int i;
@@ -590,7 +574,6 @@ print_derives()
#endif
-void
set_nullable()
{
register int i, j;
@@ -640,14 +623,12 @@ set_nullable()
}
-void
free_nullable()
{
FREE(nullable);
}
-void
lr0()
{
set_derives();
diff --git a/frontend/jay/main.c b/frontend/jay/main.c
index 566596a..bd7a4f5 100644
--- a/frontend/jay/main.c
+++ b/frontend/jay/main.c
@@ -98,7 +98,6 @@ extern char* mktemp();
extern char *getenv();
-void
done(k)
int k;
{
@@ -117,7 +116,6 @@ onintr(signo)
}
-void
set_signals()
{
#ifdef SIGINT
@@ -135,7 +133,6 @@ set_signals()
}
-void
usage()
{
fprintf(stderr, "usage: %s [-tvcp] [-b file_prefix] filename\n", myname);
@@ -256,7 +253,6 @@ unsigned n;
}
-void
create_file_names()
{
int i, len;
@@ -320,7 +316,6 @@ create_file_names()
}
-void
open_files()
{
create_file_names();
@@ -369,5 +364,4 @@ char *argv[];
output();
done(0);
/*NOTREACHED*/
- return (-1);
}
diff --git a/frontend/jay/mkpar.c b/frontend/jay/mkpar.c
index f6f8629..42ead14 100644
--- a/frontend/jay/mkpar.c
+++ b/frontend/jay/mkpar.c
@@ -59,7 +59,6 @@ extern action *add_reductions();
extern action *add_reduce();
-void
make_parser()
{
register int i;
@@ -190,7 +189,6 @@ register int ruleno, symbol;
}
-void
find_final_state()
{
register int goal, i;
@@ -208,7 +206,6 @@ find_final_state()
}
-void
unused_rules()
{
register int i;
@@ -241,7 +238,6 @@ unused_rules()
}
-void
remove_conflicts()
{
register int i;
@@ -317,7 +313,6 @@ remove_conflicts()
}
-void
total_conflicts()
{
fprintf(stderr, "%s: ", myname);
@@ -367,7 +362,6 @@ int stateno;
}
-void
defreds()
{
register int i;
@@ -377,7 +371,6 @@ defreds()
defred[i] = sole_reduction(i);
}
-void
free_action_row(p)
register action *p;
{
@@ -391,7 +384,6 @@ register action *p;
}
}
-void
free_parser()
{
register int i;
diff --git a/frontend/jay/output.c b/frontend/jay/output.c
index c8ee82c..cf504cd 100644
--- a/frontend/jay/output.c
+++ b/frontend/jay/output.c
@@ -62,7 +62,6 @@ void save_column (int symbol, int default_state);
void output_trailing_text (void);
void output_semantic_actions (void);
-void
output () {
int lno = 0;
char buf [128];
@@ -103,7 +102,6 @@ output () {
free_parser();
}
-void
output_rule_data()
{
register int i;
@@ -156,7 +154,6 @@ output_rule_data()
}
-void
output_yydefred()
{
register int i, j;
@@ -186,7 +183,6 @@ output_yydefred()
}
-void
output_actions()
{
nvectors = 2*nstates + nvars;
@@ -215,7 +211,6 @@ output_actions()
}
-void
token_actions()
{
register int i, j;
@@ -300,7 +295,6 @@ token_actions()
FREE(actionrow);
}
-void
goto_actions()
{
register int i, j, k;
@@ -412,7 +406,6 @@ int default_state;
width[symno] = sp1[-1] - sp[0] + 1;
}
-void
sort_actions()
{
register int i;
@@ -448,7 +441,6 @@ sort_actions()
}
-void
pack_table()
{
register int i;
@@ -626,13 +618,10 @@ int vector;
return (j);
}
}
- /*NOTREACHED*/
- return (-1);
}
-void
output_base()
{
register int i, j;
@@ -701,7 +690,6 @@ output_base()
-void
output_table()
{
register int i;
@@ -731,7 +719,6 @@ output_table()
-void
output_check()
{
register int i;
@@ -795,7 +782,6 @@ char *name;
}
-void
output_defines(prefix)
char *prefix;
{
@@ -835,7 +821,6 @@ char *prefix;
}
-void
output_stored_text(file, name)
FILE *file;
char *name;
@@ -863,7 +848,6 @@ char *name;
}
-void
output_debug()
{
register int i, j, k, max;
@@ -1154,7 +1138,6 @@ output_semantic_actions()
}
-void
free_itemsets()
{
register core *cp, *next;
@@ -1168,7 +1151,6 @@ free_itemsets()
}
-void
free_shifts()
{
register shifts *sp, *next;
@@ -1183,7 +1165,6 @@ free_shifts()
-void
free_reductions()
{
register reductions *rp, *next;
diff --git a/frontend/jay/reader.c b/frontend/jay/reader.c
index 2a48a03..918f6a0 100644
--- a/frontend/jay/reader.c
+++ b/frontend/jay/reader.c
@@ -74,7 +74,7 @@ char *name_pool;
char *line_format = "\t\t\t\t\t// line %d \"%s\"\n";
char *default_line_format = "\t\t\t\t\t// line %d\n";
-void
+
cachec(c)
int c;
{
@@ -243,8 +243,6 @@ nextc()
return (*s);
}
}
- /*NOTREACHED*/
- return (-1);
}
@@ -304,7 +302,6 @@ keyword()
}
syntax_error(lineno, line, t_cptr);
/*NOTREACHED*/
- return (-1);
}
void
@@ -779,7 +776,6 @@ declare_types()
}
-void
declare_start()
{
register int c;
@@ -839,7 +835,6 @@ read_declarations()
}
-void
initialize_grammar()
{
nitems = 4;
@@ -871,7 +866,6 @@ initialize_grammar()
}
-void
expand_items()
{
maxitems += 300;
@@ -880,7 +874,6 @@ expand_items()
}
-void
expand_rules()
{
maxrules += 100;
@@ -893,7 +886,6 @@ expand_rules()
}
-void
advance_to_start()
{
register int c;
@@ -944,7 +936,6 @@ advance_to_start()
}
-void
start_rule(bp, s_lineno)
register bucket *bp;
int s_lineno;
@@ -960,7 +951,6 @@ int s_lineno;
}
-void
end_rule()
{
register int i;
@@ -980,7 +970,6 @@ end_rule()
}
-void
insert_empty_rule()
{
register bucket *bp, **bpp;
@@ -1313,7 +1302,6 @@ mark_symbol()
}
-void
read_grammar()
{
register int c;
@@ -1362,7 +1350,6 @@ free_tags()
}
-void
pack_names()
{
register bucket *bp;
@@ -1388,7 +1375,6 @@ pack_names()
}
-void
check_symbols()
{
register bucket *bp;
@@ -1407,7 +1393,6 @@ check_symbols()
}
-void
pack_symbols()
{
register bucket *bp;
@@ -1532,7 +1517,6 @@ pack_symbols()
}
-void
pack_grammar()
{
register int i, j;
@@ -1628,7 +1612,6 @@ print_grammar()
}
-void
reader()
{
create_symbol_table();
diff --git a/frontend/jay/symtab.c b/frontend/jay/symtab.c
index bc5660d..0c5f55c 100644
--- a/frontend/jay/symtab.c
+++ b/frontend/jay/symtab.c
@@ -119,7 +119,6 @@ char *name;
}
-void
create_symbol_table()
{
register int i;
@@ -140,7 +139,6 @@ create_symbol_table()
}
-void
free_symbol_table()
{
FREE(symbol_table);
@@ -148,7 +146,6 @@ free_symbol_table()
}
-void
free_symbols()
{
register bucket *p, *q;
diff --git a/frontend/jay/verbose.c b/frontend/jay/verbose.c
index 8d64dab..ff19de2 100644
--- a/frontend/jay/verbose.c
+++ b/frontend/jay/verbose.c
@@ -67,7 +67,6 @@ verbose()
}
-void
log_unused()
{
register int i;
@@ -87,7 +86,6 @@ log_unused()
}
-void
log_conflicts()
{
register int i;
@@ -116,7 +114,6 @@ log_conflicts()
}
-void
print_state(state)
int state;
{
@@ -131,7 +128,6 @@ int state;
}
-void
print_conflicts(state)
int state;
{
@@ -180,7 +176,6 @@ int state;
}
-void
print_core(state)
int state;
{
@@ -217,7 +212,6 @@ int state;
}
-void
print_nulls(state)
int state;
{
@@ -262,7 +256,6 @@ int state;
}
-void
print_actions(stateno)
int stateno;
{
@@ -290,7 +283,6 @@ int stateno;
}
-void
print_shifts(p)
register action *p;
{
@@ -316,7 +308,6 @@ register action *p;
}
-void
print_reductions(p, defred)
register action *p;
register int defred;
@@ -355,7 +346,6 @@ register int defred;
}
-void
print_gotos(stateno)
int stateno;
{
diff --git a/frontend/jay/warshall.c b/frontend/jay/warshall.c
index 2ff4141..4672244 100644
--- a/frontend/jay/warshall.c
+++ b/frontend/jay/warshall.c
@@ -40,7 +40,6 @@ static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) 5/24/93";
#include "defs.h"
-void
transitive_closure(R, n)
unsigned *R;
int n;
@@ -93,7 +92,6 @@ int n;
}
}
-void
reflexive_transitive_closure(R, n)
unsigned *R;
int n;
diff --git a/frontend/libedit/Makefile.am b/frontend/libedit/Makefile.am
new file mode 100644
index 0000000..9e03757
--- /dev/null
+++ b/frontend/libedit/Makefile.am
@@ -0,0 +1,23 @@
+lib_LTLIBRARIES = libmonodebuggerreadline.la
+
+libmonodebuggerreadline_la_SOURCES = \
+ mono-debugger-readline.c mono-debugger-readline.h readline.c readline.h \
+ chared.c common.c el.c emacs.c fcns.c help.c hist.c history.c key.c map.c \
+ parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c vis.c unvis.c \
+ strlcpy.c strlcat.c chared.h common.h el.h emacs.h fcns.h help.h histedit.h hist.h \
+ key.h map.h parse.h prompt.h read.h refresh.h search.h sig.h sys.h term.h tty.h \
+ vi.h vis.h el_term.h filecomplete.h tokenizer.c filecomplete.c
+
+libmonodebuggerreadline_la_LIBADD = @BASE_DEPENDENCIES_LIBS@ @READLINE_DEPLIBS@
+if PLATFORM_X86_DARWIN
+libmonodebuggerreadline_la_LDFLAGS = -no-undefined -shared -Wl
+else
+libmonodebuggerreadline_la_LDFLAGS = -no-undefined -shared -Wl,-version-script=$(srcdir)/ldscript
+endif
+
+EXTRA_DIST = ldscript
+
+INCLUDES = @BASE_DEPENDENCIES_CFLAGS@ @glue_cflags@
+
+CLEANFILES = lib*.a lib*.dll
+
diff --git a/frontend/libedit/Makefile.in b/frontend/libedit/Makefile.in
new file mode 100644
index 0000000..da807e8
--- /dev/null
+++ b/frontend/libedit/Makefile.in
@@ -0,0 +1,556 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = frontend/libedit
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libmonodebuggerreadline_la_DEPENDENCIES =
+am_libmonodebuggerreadline_la_OBJECTS = mono-debugger-readline.lo \
+ readline.lo chared.lo common.lo el.lo emacs.lo fcns.lo help.lo \
+ hist.lo history.lo key.lo map.lo parse.lo prompt.lo read.lo \
+ refresh.lo search.lo sig.lo term.lo tty.lo vi.lo vis.lo \
+ unvis.lo strlcpy.lo strlcat.lo tokenizer.lo filecomplete.lo
+libmonodebuggerreadline_la_OBJECTS = \
+ $(am_libmonodebuggerreadline_la_OBJECTS)
+libmonodebuggerreadline_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libmonodebuggerreadline_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmonodebuggerreadline_la_SOURCES)
+DIST_SOURCES = $(libmonodebuggerreadline_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
+BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CECIL_ASM = @CECIL_ASM@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GACUTIL = @GACUTIL@
+GACUTIL_FLAGS = @GACUTIL_FLAGS@
+GREP = @GREP@
+HOST_CC = @HOST_CC@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_PREFIX = @LIB_PREFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MCS = @MCS@
+MKDIR_P = @MKDIR_P@
+MONO = @MONO@
+MONODIS = @MONODIS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUNIT_CONSOLE = @NUNIT_CONSOLE@
+NUNIT_PREFIX = @NUNIT_PREFIX@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH = @PATH@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
+SED = @SED@
+SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
+SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TARGET_MCS = @TARGET_MCS@
+TARGET_MONO = @TARGET_MONO@
+TARGET_MONODIS = @TARGET_MONODIS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
+WRAPPER_LIBS = @WRAPPER_LIBS@
+XSP_CFLAGS = @XSP_CFLAGS@
+XSP_EXE = @XSP_EXE@
+XSP_LIBS = @XSP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glue_cflags = @glue_cflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mono_prefix = @mono_prefix@
+monodoc_prefix = @monodoc_prefix@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+real_top_srcdir = @real_top_srcdir@
+sbindir = @sbindir@
+server_cflags = @server_cflags@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_mono_prefix = @target_mono_prefix@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+lib_LTLIBRARIES = libmonodebuggerreadline.la
+libmonodebuggerreadline_la_SOURCES = \
+ mono-debugger-readline.c mono-debugger-readline.h readline.c readline.h \
+ chared.c common.c el.c emacs.c fcns.c help.c hist.c history.c key.c map.c \
+ parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c vis.c unvis.c \
+ strlcpy.c strlcat.c chared.h common.h el.h emacs.h fcns.h help.h histedit.h hist.h \
+ key.h map.h parse.h prompt.h read.h refresh.h search.h sig.h sys.h term.h tty.h \
+ vi.h vis.h el_term.h filecomplete.h tokenizer.c filecomplete.c
+
+libmonodebuggerreadline_la_LIBADD = @BASE_DEPENDENCIES_LIBS@ @READLINE_DEPLIBS@
+ at PLATFORM_X86_DARWIN_FALSE@libmonodebuggerreadline_la_LDFLAGS = -no-undefined -shared -Wl,-version-script=$(srcdir)/ldscript
+ at PLATFORM_X86_DARWIN_TRUE@libmonodebuggerreadline_la_LDFLAGS = -no-undefined -shared -Wl
+EXTRA_DIST = ldscript
+INCLUDES = @BASE_DEPENDENCIES_CFLAGS@ @glue_cflags@
+CLEANFILES = lib*.a lib*.dll
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu frontend/libedit/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu frontend/libedit/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmonodebuggerreadline.la: $(libmonodebuggerreadline_la_OBJECTS) $(libmonodebuggerreadline_la_DEPENDENCIES)
+ $(libmonodebuggerreadline_la_LINK) -rpath $(libdir) $(libmonodebuggerreadline_la_OBJECTS) $(libmonodebuggerreadline_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/chared.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/common.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/el.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/emacs.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fcns.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/filecomplete.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/help.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/history.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/key.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/map.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mono-debugger-readline.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/prompt.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readline.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/refresh.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/search.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sig.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/strlcat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/strlcpy.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/term.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tokenizer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tty.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unvis.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vis.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/frontend/libedit/chared.c b/frontend/libedit/chared.c
new file mode 100644
index 0000000..4b1e754
--- /dev/null
+++ b/frontend/libedit/chared.c
@@ -0,0 +1,771 @@
+/* $NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+/*
+ * chared.c: Character editor utilities
+ */
+#include <stdlib.h>
+#include "sys.h"
+#include "el.h"
+
+private void ch__clearmacro __P((EditLine *));
+
+/* value to leave unused in line buffer */
+#define EL_LEAVE 2
+
+/* cv_undo():
+ * Handle state for the vi undo command
+ */
+protected void
+cv_undo(EditLine *el)
+{
+ c_undo_t *vu = &el->el_chared.c_undo;
+ c_redo_t *r = &el->el_chared.c_redo;
+ unsigned int size;
+
+ /* Save entire line for undo */
+ size = el->el_line.lastchar - el->el_line.buffer;
+ vu->len = size;
+ vu->cursor = el->el_line.cursor - el->el_line.buffer;
+ memcpy(vu->buf, el->el_line.buffer, size);
+
+ /* save command info for redo */
+ r->count = el->el_state.doingarg ? el->el_state.argument : 0;
+ r->action = el->el_chared.c_vcmd.action;
+ r->pos = r->buf;
+ r->cmd = el->el_state.thiscmd;
+ r->ch = el->el_state.thisch;
+}
+
+/* cv_yank():
+ * Save yank/delete data for paste
+ */
+protected void
+cv_yank(EditLine *el, const char *ptr, int size)
+{
+ c_kill_t *k = &el->el_chared.c_kill;
+
+ memcpy(k->buf, ptr, size +0u);
+ k->last = k->buf + size;
+}
+
+
+/* c_insert():
+ * Insert num characters
+ */
+protected void
+c_insert(EditLine *el, int num)
+{
+ char *cp;
+
+ if (el->el_line.lastchar + num >= el->el_line.limit) {
+ if (!ch_enlargebufs(el, num +0u))
+ return; /* can't go past end of buffer */
+ }
+
+ if (el->el_line.cursor < el->el_line.lastchar) {
+ /* if I must move chars */
+ for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--)
+ cp[num] = *cp;
+ }
+ el->el_line.lastchar += num;
+}
+
+
+/* c_delafter():
+ * Delete num characters after the cursor
+ */
+protected void
+c_delafter(EditLine *el, int num)
+{
+
+ if (el->el_line.cursor + num > el->el_line.lastchar)
+ num = el->el_line.lastchar - el->el_line.cursor;
+
+ if (el->el_map.current != el->el_map.emacs) {
+ cv_undo(el);
+ cv_yank(el, el->el_line.cursor, num);
+ }
+
+ if (num > 0) {
+ char *cp;
+
+ for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
+ *cp = cp[num];
+
+ el->el_line.lastchar -= num;
+ }
+}
+
+
+/* c_delafter1():
+ * Delete the character after the cursor, do not yank
+ */
+protected void
+c_delafter1(EditLine *el)
+{
+ char *cp;
+
+ for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
+ *cp = cp[1];
+
+ el->el_line.lastchar--;
+}
+
+
+/* c_delbefore():
+ * Delete num characters before the cursor
+ */
+protected void
+c_delbefore(EditLine *el, int num)
+{
+
+ if (el->el_line.cursor - num < el->el_line.buffer)
+ num = el->el_line.cursor - el->el_line.buffer;
+
+ if (el->el_map.current != el->el_map.emacs) {
+ cv_undo(el);
+ cv_yank(el, el->el_line.cursor - num, num);
+ }
+
+ if (num > 0) {
+ char *cp;
+
+ for (cp = el->el_line.cursor - num;
+ cp <= el->el_line.lastchar;
+ cp++)
+ *cp = cp[num];
+
+ el->el_line.lastchar -= num;
+ }
+}
+
+
+/* c_delbefore1():
+ * Delete the character before the cursor, do not yank
+ */
+protected void
+c_delbefore1(EditLine *el)
+{
+ char *cp;
+
+ for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++)
+ *cp = cp[1];
+
+ el->el_line.lastchar--;
+}
+
+
+/* ce__isword():
+ * Return if p is part of a word according to emacs
+ */
+protected int
+ce__isword(int p)
+{
+ return (isalnum(p) || strchr("*?_-[]~=", p) != NULL);
+}
+
+
+/* cv__isword():
+ * Return if p is part of a word according to vi
+ */
+protected int
+cv__isword(int p)
+{
+ if (isalnum(p) || p == '_')
+ return 1;
+ if (isgraph(p))
+ return 2;
+ return 0;
+}
+
+
+/* cv__isWord():
+ * Return if p is part of a big word according to vi
+ */
+protected int
+cv__isWord(int p)
+{
+ return (!isspace(p));
+}
+
+
+/* c__prev_word():
+ * Find the previous word
+ */
+protected char *
+c__prev_word(char *p, char *low, int n, int (*wtest)(int))
+{
+ p--;
+
+ while (n--) {
+ while ((p >= low) && !(*wtest)((unsigned char) *p))
+ p--;
+ while ((p >= low) && (*wtest)((unsigned char) *p))
+ p--;
+ }
+
+ /* cp now points to one character before the word */
+ p++;
+ if (p < low)
+ p = low;
+ /* cp now points where we want it */
+ return (p);
+}
+
+
+/* c__next_word():
+ * Find the next word
+ */
+protected char *
+c__next_word(char *p, char *high, int n, int (*wtest)(int))
+{
+ while (n--) {
+ while ((p < high) && !(*wtest)((unsigned char) *p))
+ p++;
+ while ((p < high) && (*wtest)((unsigned char) *p))
+ p++;
+ }
+ if (p > high)
+ p = high;
+ /* p now points where we want it */
+ return (p);
+}
+
+/* cv_next_word():
+ * Find the next word vi style
+ */
+protected char *
+cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int))
+{
+ int test;
+
+ while (n--) {
+ test = (*wtest)((unsigned char) *p);
+ while ((p < high) && (*wtest)((unsigned char) *p) == test)
+ p++;
+ /*
+ * vi historically deletes with cw only the word preserving the
+ * trailing whitespace! This is not what 'w' does..
+ */
+ if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT))
+ while ((p < high) && isspace((unsigned char) *p))
+ p++;
+ }
+
+ /* p now points where we want it */
+ if (p > high)
+ return (high);
+ else
+ return (p);
+}
+
+
+/* cv_prev_word():
+ * Find the previous word vi style
+ */
+protected char *
+cv_prev_word(char *p, char *low, int n, int (*wtest)(int))
+{
+ int test;
+
+ p--;
+ while (n--) {
+ while ((p > low) && isspace((unsigned char) *p))
+ p--;
+ test = (*wtest)((unsigned char) *p);
+ while ((p >= low) && (*wtest)((unsigned char) *p) == test)
+ p--;
+ }
+ p++;
+
+ /* p now points where we want it */
+ if (p < low)
+ return (low);
+ else
+ return (p);
+}
+
+
+#ifdef notdef
+/* c__number():
+ * Ignore character p points to, return number appearing after that.
+ * A '$' by itself means a big number; "$-" is for negative; '^' means 1.
+ * Return p pointing to last char used.
+ */
+protected char *
+c__number(
+ char *p, /* character position */
+ int *num, /* Return value */
+ int dval) /* dval is the number to subtract from like $-3 */
+{
+ int i;
+ int sign = 1;
+
+ if (*++p == '^') {
+ *num = 1;
+ return (p);
+ }
+ if (*p == '$') {
+ if (*++p != '-') {
+ *num = 0x7fffffff; /* Handle $ */
+ return (--p);
+ }
+ sign = -1; /* Handle $- */
+ ++p;
+ }
+ for (i = 0; isdigit((unsigned char) *p); i = 10 * i + *p++ - '0')
+ continue;
+ *num = (sign < 0 ? dval - i : i);
+ return (--p);
+}
+#endif
+
+/* cv_delfini():
+ * Finish vi delete action
+ */
+protected void
+cv_delfini(EditLine *el)
+{
+ int size;
+ int action = el->el_chared.c_vcmd.action;
+
+ if (action & INSERT)
+ el->el_map.current = el->el_map.key;
+
+ if (el->el_chared.c_vcmd.pos == 0)
+ /* sanity */
+ return;
+
+ size = el->el_line.cursor - el->el_chared.c_vcmd.pos;
+ if (size == 0)
+ size = 1;
+ el->el_line.cursor = el->el_chared.c_vcmd.pos;
+ if (action & YANK) {
+ if (size > 0)
+ cv_yank(el, el->el_line.cursor, size);
+ else
+ cv_yank(el, el->el_line.cursor + size, -size);
+ } else {
+ if (size > 0) {
+ c_delafter(el, size);
+ re_refresh_cursor(el);
+ } else {
+ c_delbefore(el, -size);
+ el->el_line.cursor += size;
+ }
+ }
+ el->el_chared.c_vcmd.action = NOP;
+}
+
+
+#ifdef notdef
+/* ce__endword():
+ * Go to the end of this word according to emacs
+ */
+protected char *
+ce__endword(char *p, char *high, int n)
+{
+ p++;
+
+ while (n--) {
+ while ((p < high) && isspace((unsigned char) *p))
+ p++;
+ while ((p < high) && !isspace((unsigned char) *p))
+ p++;
+ }
+
+ p--;
+ return (p);
+}
+#endif
+
+
+/* cv__endword():
+ * Go to the end of this word according to vi
+ */
+protected char *
+cv__endword(char *p, char *high, int n, int (*wtest)(int))
+{
+ int test;
+
+ p++;
+
+ while (n--) {
+ while ((p < high) && isspace((unsigned char) *p))
+ p++;
+
+ test = (*wtest)((unsigned char) *p);
+ while ((p < high) && (*wtest)((unsigned char) *p) == test)
+ p++;
+ }
+ p--;
+ return (p);
+}
+
+/* ch_init():
+ * Initialize the character editor
+ */
+protected int
+ch_init(EditLine *el)
+{
+ c_macro_t *ma = &el->el_chared.c_macro;
+
+ el->el_line.buffer = (char *) el_malloc(EL_BUFSIZ);
+ if (el->el_line.buffer == NULL)
+ return (-1);
+
+ (void) memset(el->el_line.buffer, 0, EL_BUFSIZ);
+ el->el_line.cursor = el->el_line.buffer;
+ el->el_line.lastchar = el->el_line.buffer;
+ el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE];
+
+ el->el_chared.c_undo.buf = (char *) el_malloc(EL_BUFSIZ);
+ if (el->el_chared.c_undo.buf == NULL)
+ return (-1);
+ (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ);
+ el->el_chared.c_undo.len = -1;
+ el->el_chared.c_undo.cursor = 0;
+ el->el_chared.c_redo.buf = (char *) el_malloc(EL_BUFSIZ);
+ if (el->el_chared.c_redo.buf == NULL)
+ return (-1);
+ el->el_chared.c_redo.pos = el->el_chared.c_redo.buf;
+ el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ;
+ el->el_chared.c_redo.cmd = ED_UNASSIGNED;
+
+ el->el_chared.c_vcmd.action = NOP;
+ el->el_chared.c_vcmd.pos = el->el_line.buffer;
+
+ el->el_chared.c_kill.buf = (char *) el_malloc(EL_BUFSIZ);
+ if (el->el_chared.c_kill.buf == NULL)
+ return (-1);
+ (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ);
+ el->el_chared.c_kill.mark = el->el_line.buffer;
+ el->el_chared.c_kill.last = el->el_chared.c_kill.buf;
+
+ el->el_map.current = el->el_map.key;
+
+ el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */
+ el->el_state.doingarg = 0;
+ el->el_state.metanext = 0;
+ el->el_state.argument = 1;
+ el->el_state.lastcmd = ED_UNASSIGNED;
+
+ ma->level = -1;
+ ma->offset = 0;
+ ma->macro = (char **) el_malloc(EL_MAXMACRO * sizeof(char *));
+ if (ma->macro == NULL)
+ return (-1);
+ return (0);
+}
+
+/* ch_reset():
+ * Reset the character editor
+ */
+protected void
+ch_reset(EditLine *el, int mclear)
+{
+ el->el_line.cursor = el->el_line.buffer;
+ el->el_line.lastchar = el->el_line.buffer;
+
+ el->el_chared.c_undo.len = -1;
+ el->el_chared.c_undo.cursor = 0;
+
+ el->el_chared.c_vcmd.action = NOP;
+ el->el_chared.c_vcmd.pos = el->el_line.buffer;
+
+ el->el_chared.c_kill.mark = el->el_line.buffer;
+
+ el->el_map.current = el->el_map.key;
+
+ el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */
+ el->el_state.doingarg = 0;
+ el->el_state.metanext = 0;
+ el->el_state.argument = 1;
+ el->el_state.lastcmd = ED_UNASSIGNED;
+
+ el->el_history.eventno = 0;
+
+ if (mclear)
+ ch__clearmacro(el);
+}
+
+private void
+ch__clearmacro(el)
+ EditLine *el;
+{
+ c_macro_t *ma = &el->el_chared.c_macro;
+ while (ma->level >= 0)
+ el_free((ptr_t)ma->macro[ma->level--]);
+}
+
+/* ch_enlargebufs():
+ * Enlarge line buffer to be able to hold twice as much characters.
+ * Returns 1 if successful, 0 if not.
+ */
+protected int
+ch_enlargebufs(el, addlen)
+ EditLine *el;
+ size_t addlen;
+{
+ size_t sz, newsz;
+ char *newbuffer, *oldbuf, *oldkbuf;
+
+ sz = el->el_line.limit - el->el_line.buffer + EL_LEAVE;
+ newsz = sz * 2;
+ /*
+ * If newly required length is longer than current buffer, we need
+ * to make the buffer big enough to hold both old and new stuff.
+ */
+ if (addlen > sz) {
+ while(newsz - sz < addlen)
+ newsz *= 2;
+ }
+
+ /*
+ * Reallocate line buffer.
+ */
+ newbuffer = el_realloc(el->el_line.buffer, newsz);
+ if (!newbuffer)
+ return 0;
+
+ /* zero the newly added memory, leave old data in */
+ (void) memset(&newbuffer[sz], 0, newsz - sz);
+
+ oldbuf = el->el_line.buffer;
+
+ el->el_line.buffer = newbuffer;
+ el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf);
+ el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf);
+ /* don't set new size until all buffers are enlarged */
+ el->el_line.limit = &newbuffer[sz - EL_LEAVE];
+
+ /*
+ * Reallocate kill buffer.
+ */
+ newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz);
+ if (!newbuffer)
+ return 0;
+
+ /* zero the newly added memory, leave old data in */
+ (void) memset(&newbuffer[sz], 0, newsz - sz);
+
+ oldkbuf = el->el_chared.c_kill.buf;
+
+ el->el_chared.c_kill.buf = newbuffer;
+ el->el_chared.c_kill.last = newbuffer +
+ (el->el_chared.c_kill.last - oldkbuf);
+ el->el_chared.c_kill.mark = el->el_line.buffer +
+ (el->el_chared.c_kill.mark - oldbuf);
+
+ /*
+ * Reallocate undo buffer.
+ */
+ newbuffer = el_realloc(el->el_chared.c_undo.buf, newsz);
+ if (!newbuffer)
+ return 0;
+
+ /* zero the newly added memory, leave old data in */
+ (void) memset(&newbuffer[sz], 0, newsz - sz);
+ el->el_chared.c_undo.buf = newbuffer;
+
+ newbuffer = el_realloc(el->el_chared.c_redo.buf, newsz);
+ if (!newbuffer)
+ return 0;
+ el->el_chared.c_redo.pos = newbuffer +
+ (el->el_chared.c_redo.pos - el->el_chared.c_redo.buf);
+ el->el_chared.c_redo.lim = newbuffer +
+ (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf);
+ el->el_chared.c_redo.buf = newbuffer;
+
+ if (!hist_enlargebuf(el, sz, newsz))
+ return 0;
+
+ /* Safe to set enlarged buffer size */
+ el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE];
+ return 1;
+}
+
+/* ch_end():
+ * Free the data structures used by the editor
+ */
+protected void
+ch_end(EditLine *el)
+{
+ el_free((ptr_t) el->el_line.buffer);
+ el->el_line.buffer = NULL;
+ el->el_line.limit = NULL;
+ el_free((ptr_t) el->el_chared.c_undo.buf);
+ el->el_chared.c_undo.buf = NULL;
+ el_free((ptr_t) el->el_chared.c_redo.buf);
+ el->el_chared.c_redo.buf = NULL;
+ el->el_chared.c_redo.pos = NULL;
+ el->el_chared.c_redo.lim = NULL;
+ el->el_chared.c_redo.cmd = ED_UNASSIGNED;
+ el_free((ptr_t) el->el_chared.c_kill.buf);
+ el->el_chared.c_kill.buf = NULL;
+ ch_reset(el, 1);
+ el_free((ptr_t) el->el_chared.c_macro.macro);
+ el->el_chared.c_macro.macro = NULL;
+}
+
+
+/* el_insertstr():
+ * Insert string at cursorI
+ */
+public int
+el_insertstr(EditLine *el, const char *s)
+{
+ size_t len;
+
+ if ((len = strlen(s)) == 0)
+ return (-1);
+ if (el->el_line.lastchar + len >= el->el_line.limit) {
+ if (!ch_enlargebufs(el, len))
+ return (-1);
+ }
+
+ c_insert(el, (int)len);
+ while (*s)
+ *el->el_line.cursor++ = *s++;
+ return (0);
+}
+
+
+/* el_deletestr():
+ * Delete num characters before the cursor
+ */
+public void
+el_deletestr(EditLine *el, int n)
+{
+ if (n <= 0)
+ return;
+
+ if (el->el_line.cursor < &el->el_line.buffer[n])
+ return;
+
+ c_delbefore(el, n); /* delete before dot */
+ el->el_line.cursor -= n;
+ if (el->el_line.cursor < el->el_line.buffer)
+ el->el_line.cursor = el->el_line.buffer;
+}
+
+/* c_gets():
+ * Get a string
+ */
+protected int
+c_gets(EditLine *el, char *buf, const char *prompt)
+{
+ char ch;
+ int len;
+ char *cp = el->el_line.buffer;
+
+ if (prompt) {
+ len = strlen(prompt);
+ memcpy(cp, prompt, len + 0u);
+ cp += len;
+ }
+ len = 0;
+
+ for (;;) {
+ el->el_line.cursor = cp;
+ *cp = ' ';
+ el->el_line.lastchar = cp + 1;
+ re_refresh(el);
+
+ if (el_getc(el, &ch) != 1) {
+ ed_end_of_file(el, 0);
+ len = -1;
+ break;
+ }
+
+ switch (ch) {
+
+ case 0010: /* Delete and backspace */
+ case 0177:
+ if (len <= 0) {
+ len = -1;
+ break;
+ }
+ cp--;
+ continue;
+
+ case 0033: /* ESC */
+ case '\r': /* Newline */
+ case '\n':
+ buf[len] = ch;
+ break;
+
+ default:
+ if (len >= EL_BUFSIZ - 16)
+ term_beep(el);
+ else {
+ buf[len++] = ch;
+ *cp++ = ch;
+ }
+ continue;
+ }
+ break;
+ }
+
+ el->el_line.buffer[0] = '\0';
+ el->el_line.lastchar = el->el_line.buffer;
+ el->el_line.cursor = el->el_line.buffer;
+ return len;
+}
+
+
+/* c_hpos():
+ * Return the current horizontal position of the cursor
+ */
+protected int
+c_hpos(EditLine *el)
+{
+ char *ptr;
+
+ /*
+ * Find how many characters till the beginning of this line.
+ */
+ if (el->el_line.cursor == el->el_line.buffer)
+ return (0);
+ else {
+ for (ptr = el->el_line.cursor - 1;
+ ptr >= el->el_line.buffer && *ptr != '\n';
+ ptr--)
+ continue;
+ return (el->el_line.cursor - ptr - 1);
+ }
+}
diff --git a/frontend/libedit/chared.h b/frontend/libedit/chared.h
new file mode 100644
index 0000000..d1bf254
--- /dev/null
+++ b/frontend/libedit/chared.h
@@ -0,0 +1,167 @@
+/* $NetBSD: chared.h,v 1.17 2006/03/06 21:11:56 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)chared.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.chared.h: Character editor interface
+ */
+#ifndef _h_el_chared
+#define _h_el_chared
+
+#include <ctype.h>
+#include <string.h>
+
+#include "histedit.h"
+
+#define EL_MAXMACRO 10
+
+/*
+ * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works
+ * like real vi: i.e. the transition from command<->insert modes moves
+ * the cursor.
+ *
+ * On the other hand we really don't want to move the cursor, because
+ * all the editing commands don't include the character under the cursor.
+ * Probably the best fix is to make all the editing commands aware of
+ * this fact.
+ */
+#define VI_MOVE
+
+
+typedef struct c_macro_t {
+ int level;
+ int offset;
+ char **macro;
+} c_macro_t;
+
+/*
+ * Undo information for vi - no undo in emacs (yet)
+ */
+typedef struct c_undo_t {
+ int len; /* length of saved line */
+ int cursor; /* position of saved cursor */
+ char *buf; /* full saved text */
+} c_undo_t;
+
+/* redo for vi */
+typedef struct c_redo_t {
+ char *buf; /* redo insert key sequence */
+ char *pos;
+ char *lim;
+ el_action_t cmd; /* command to redo */
+ char ch; /* char that invoked it */
+ int count;
+ int action; /* from cv_action() */
+} c_redo_t;
+
+/*
+ * Current action information for vi
+ */
+typedef struct c_vcmd_t {
+ int action;
+ char *pos;
+} c_vcmd_t;
+
+/*
+ * Kill buffer for emacs
+ */
+typedef struct c_kill_t {
+ char *buf;
+ char *last;
+ char *mark;
+} c_kill_t;
+
+/*
+ * Note that we use both data structures because the user can bind
+ * commands from both editors!
+ */
+typedef struct el_chared_t {
+ c_undo_t c_undo;
+ c_kill_t c_kill;
+ c_redo_t c_redo;
+ c_vcmd_t c_vcmd;
+ c_macro_t c_macro;
+} el_chared_t;
+
+
+#define STRQQ "\"\""
+
+#define isglob(a) (strchr("*[]?", (a)) != NULL)
+#define isword(a) (isprint(a))
+
+#define NOP 0x00
+#define DELETE 0x01
+#define INSERT 0x02
+#define YANK 0x04
+
+#define CHAR_FWD (+1)
+#define CHAR_BACK (-1)
+
+#define MODE_INSERT 0
+#define MODE_REPLACE 1
+#define MODE_REPLACE_1 2
+
+#include "common.h"
+#include "vi.h"
+#include "emacs.h"
+#include "search.h"
+#include "fcns.h"
+
+
+protected int cv__isword(int);
+protected int cv__isWord(int);
+protected void cv_delfini(EditLine *);
+protected char *cv__endword(char *, char *, int, int (*)(int));
+protected int ce__isword(int);
+protected void cv_undo(EditLine *);
+protected void cv_yank(EditLine *, const char *, int);
+protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int));
+protected char *cv_prev_word(char *, char *, int, int (*)(int));
+protected char *c__next_word(char *, char *, int, int (*)(int));
+protected char *c__prev_word(char *, char *, int, int (*)(int));
+protected void c_insert(EditLine *, int);
+protected void c_delbefore(EditLine *, int);
+protected void c_delbefore1(EditLine *);
+protected void c_delafter(EditLine *, int);
+protected void c_delafter1(EditLine *);
+protected int c_gets(EditLine *, char *, const char *);
+protected int c_hpos(EditLine *);
+
+protected int ch_init(EditLine *);
+protected void ch_reset(EditLine *, int);
+protected int ch_enlargebufs(EditLine *, size_t);
+protected void ch_end(EditLine *);
+
+#endif /* _h_el_chared */
diff --git a/frontend/libedit/common.c b/frontend/libedit/common.c
new file mode 100644
index 0000000..d42f49d
--- /dev/null
+++ b/frontend/libedit/common.c
@@ -0,0 +1,915 @@
+/* $NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * common.c: Common Editor functions
+ */
+#include "el.h"
+
+/* ed_end_of_file():
+ * Indicate end of file
+ * [^D]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_end_of_file(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ re_goto_bottom(el);
+ *el->el_line.lastchar = '\0';
+ return (CC_EOF);
+}
+
+
+/* ed_insert():
+ * Add character to the line
+ * Insert a character [bound to all insert keys]
+ */
+protected el_action_t
+ed_insert(EditLine *el, int c)
+{
+ int count = el->el_state.argument;
+
+ if (c == '\0')
+ return (CC_ERROR);
+
+ if (el->el_line.lastchar + el->el_state.argument >=
+ el->el_line.limit) {
+ /* end of buffer space, try to allocate more */
+ if (!ch_enlargebufs(el, (size_t) count))
+ return CC_ERROR; /* error allocating more */
+ }
+
+ if (count == 1) {
+ if (el->el_state.inputmode == MODE_INSERT
+ || el->el_line.cursor >= el->el_line.lastchar)
+ c_insert(el, 1);
+
+ *el->el_line.cursor++ = c;
+ re_fastaddc(el); /* fast refresh for one char. */
+ } else {
+ if (el->el_state.inputmode != MODE_REPLACE_1)
+ c_insert(el, el->el_state.argument);
+
+ while (count-- && el->el_line.cursor < el->el_line.lastchar)
+ *el->el_line.cursor++ = c;
+ re_refresh(el);
+ }
+
+ if (el->el_state.inputmode == MODE_REPLACE_1)
+ return vi_command_mode(el, 0);
+
+ return (CC_NORM);
+}
+
+
+/* ed_delete_prev_word():
+ * Delete from beginning of current word to cursor
+ * [M-^?] [^W]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp, *p, *kp;
+
+ if (el->el_line.cursor == el->el_line.buffer)
+ return (CC_ERROR);
+
+ cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
+ el->el_state.argument, ce__isword);
+
+ for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++)
+ *kp++ = *p;
+ el->el_chared.c_kill.last = kp;
+
+ c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */
+ el->el_line.cursor = cp;
+ if (el->el_line.cursor < el->el_line.buffer)
+ el->el_line.cursor = el->el_line.buffer; /* bounds check */
+ return (CC_REFRESH);
+}
+
+
+/* ed_delete_next_char():
+ * Delete character under cursor
+ * [^D] [x]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_delete_next_char(EditLine *el, int c)
+{
+#ifdef notdef /* XXX */
+#define EL el->el_line
+ (void) fprintf(el->el_errlfile,
+ "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n",
+ EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar,
+ EL.lastchar, EL.limit, EL.limit);
+#endif
+ if (el->el_line.cursor == el->el_line.lastchar) {
+ /* if I'm at the end */
+ if (el->el_map.type == MAP_VI) {
+ if (el->el_line.cursor == el->el_line.buffer) {
+ /* if I'm also at the beginning */
+#ifdef KSHVI
+ return (CC_ERROR);
+#else
+ /* then do an EOF */
+ term_writechar(el, c);
+ return (CC_EOF);
+#endif
+ } else {
+#ifdef KSHVI
+ el->el_line.cursor--;
+#else
+ return (CC_ERROR);
+#endif
+ }
+ } else {
+ if (el->el_line.cursor != el->el_line.buffer)
+ el->el_line.cursor--;
+ else
+ return (CC_ERROR);
+ }
+ }
+ c_delafter(el, el->el_state.argument); /* delete after dot */
+ if (el->el_line.cursor >= el->el_line.lastchar &&
+ el->el_line.cursor > el->el_line.buffer)
+ /* bounds check */
+ el->el_line.cursor = el->el_line.lastchar - 1;
+ return (CC_REFRESH);
+}
+
+
+/* ed_kill_line():
+ * Cut to the end of line
+ * [^K] [^K]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_kill_line(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *kp, *cp;
+
+ cp = el->el_line.cursor;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_line.lastchar)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ /* zap! -- delete to end */
+ el->el_line.lastchar = el->el_line.cursor;
+ return (CC_REFRESH);
+}
+
+
+/* ed_move_to_end():
+ * Move cursor to the end of line
+ * [^E] [^E]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_move_to_end(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_line.cursor = el->el_line.lastchar;
+ if (el->el_map.type == MAP_VI) {
+#ifdef VI_MOVE
+ el->el_line.cursor--;
+#endif
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ }
+ return (CC_CURSOR);
+}
+
+
+/* ed_move_to_beg():
+ * Move cursor to the beginning of line
+ * [^A] [^A]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_move_to_beg(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_line.cursor = el->el_line.buffer;
+
+ if (el->el_map.type == MAP_VI) {
+ /* We want FIRST non space character */
+ while (isspace((unsigned char) *el->el_line.cursor))
+ el->el_line.cursor++;
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ }
+ return (CC_CURSOR);
+}
+
+
+/* ed_transpose_chars():
+ * Exchange the character to the left of the cursor with the one under it
+ * [^T] [^T]
+ */
+protected el_action_t
+ed_transpose_chars(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor < el->el_line.lastchar) {
+ if (el->el_line.lastchar <= &el->el_line.buffer[1])
+ return (CC_ERROR);
+ else
+ el->el_line.cursor++;
+ }
+ if (el->el_line.cursor > &el->el_line.buffer[1]) {
+ /* must have at least two chars entered */
+ c = el->el_line.cursor[-2];
+ el->el_line.cursor[-2] = el->el_line.cursor[-1];
+ el->el_line.cursor[-1] = c;
+ return (CC_REFRESH);
+ } else
+ return (CC_ERROR);
+}
+
+
+/* ed_next_char():
+ * Move to the right one character
+ * [^F] [^F]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_next_char(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *lim = el->el_line.lastchar;
+
+ if (el->el_line.cursor >= lim ||
+ (el->el_line.cursor == lim - 1 &&
+ el->el_map.type == MAP_VI &&
+ el->el_chared.c_vcmd.action == NOP))
+ return (CC_ERROR);
+
+ el->el_line.cursor += el->el_state.argument;
+ if (el->el_line.cursor > lim)
+ el->el_line.cursor = lim;
+
+ if (el->el_map.type == MAP_VI)
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* ed_prev_word():
+ * Move to the beginning of the current word
+ * [M-b] [b]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_prev_word(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor == el->el_line.buffer)
+ return (CC_ERROR);
+
+ el->el_line.cursor = c__prev_word(el->el_line.cursor,
+ el->el_line.buffer,
+ el->el_state.argument,
+ ce__isword);
+
+ if (el->el_map.type == MAP_VI)
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* ed_prev_char():
+ * Move to the left one character
+ * [^B] [^B]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor > el->el_line.buffer) {
+ el->el_line.cursor -= el->el_state.argument;
+ if (el->el_line.cursor < el->el_line.buffer)
+ el->el_line.cursor = el->el_line.buffer;
+
+ if (el->el_map.type == MAP_VI)
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+ } else
+ return (CC_ERROR);
+}
+
+
+/* ed_quoted_insert():
+ * Add the next character typed verbatim
+ * [^V] [^V]
+ */
+protected el_action_t
+ed_quoted_insert(EditLine *el, int c)
+{
+ int num;
+ char tc;
+
+ tty_quotemode(el);
+ num = el_getc(el, &tc);
+ c = (unsigned char) tc;
+ tty_noquotemode(el);
+ if (num == 1)
+ return (ed_insert(el, c));
+ else
+ return (ed_end_of_file(el, 0));
+}
+
+
+/* ed_digit():
+ * Adds to argument or enters a digit
+ */
+protected el_action_t
+ed_digit(EditLine *el, int c)
+{
+
+ if (!isdigit(c))
+ return (CC_ERROR);
+
+ if (el->el_state.doingarg) {
+ /* if doing an arg, add this in... */
+ if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT)
+ el->el_state.argument = c - '0';
+ else {
+ if (el->el_state.argument > 1000000)
+ return (CC_ERROR);
+ el->el_state.argument =
+ (el->el_state.argument * 10) + (c - '0');
+ }
+ return (CC_ARGHACK);
+ }
+
+ return ed_insert(el, c);
+}
+
+
+/* ed_argument_digit():
+ * Digit that starts argument
+ * For ESC-n
+ */
+protected el_action_t
+ed_argument_digit(EditLine *el, int c)
+{
+
+ if (!isdigit(c))
+ return (CC_ERROR);
+
+ if (el->el_state.doingarg) {
+ if (el->el_state.argument > 1000000)
+ return (CC_ERROR);
+ el->el_state.argument = (el->el_state.argument * 10) +
+ (c - '0');
+ } else { /* else starting an argument */
+ el->el_state.argument = c - '0';
+ el->el_state.doingarg = 1;
+ }
+ return (CC_ARGHACK);
+}
+
+
+/* ed_unassigned():
+ * Indicates unbound character
+ * Bound to keys that are not assigned
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_unassigned(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return (CC_ERROR);
+}
+
+
+/**
+ ** TTY key handling.
+ **/
+
+/* ed_tty_sigint():
+ * Tty interrupt character
+ * [^C]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_sigint(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_tty_dsusp():
+ * Tty delayed suspend character
+ * [^Y]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_tty_flush_output():
+ * Tty flush output characters
+ * [^O]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_tty_sigquit():
+ * Tty quit character
+ * [^\]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_tty_sigtstp():
+ * Tty suspend character
+ * [^Z]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_tty_stop_output():
+ * Tty disallow output characters
+ * [^S]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_tty_start_output():
+ * Tty allow output characters
+ * [^Q]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_tty_start_output(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_newline():
+ * Execute command
+ * [^J]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_newline(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ re_goto_bottom(el);
+ *el->el_line.lastchar++ = '\n';
+ *el->el_line.lastchar = '\0';
+ return (CC_NEWLINE);
+}
+
+
+/* ed_delete_prev_char():
+ * Delete the character to the left of the cursor
+ * [^?]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor <= el->el_line.buffer)
+ return (CC_ERROR);
+
+ c_delbefore(el, el->el_state.argument);
+ el->el_line.cursor -= el->el_state.argument;
+ if (el->el_line.cursor < el->el_line.buffer)
+ el->el_line.cursor = el->el_line.buffer;
+ return (CC_REFRESH);
+}
+
+
+/* ed_clear_screen():
+ * Clear screen leaving current line at the top
+ * [^L]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_clear_screen(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ term_clear_screen(el); /* clear the whole real screen */
+ re_clear_display(el); /* reset everything */
+ return (CC_REFRESH);
+}
+
+
+/* ed_redisplay():
+ * Redisplay everything
+ * ^R
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_redisplay(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_REDISPLAY);
+}
+
+
+/* ed_start_over():
+ * Erase current line and start from scratch
+ * [^G]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_start_over(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ ch_reset(el, 0);
+ return (CC_REFRESH);
+}
+
+
+/* ed_sequence_lead_in():
+ * First character in a bound sequence
+ * Placeholder for external keys
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
+ int c __attribute__((__unused__)))
+{
+
+ return (CC_NORM);
+}
+
+
+/* ed_prev_history():
+ * Move to the previous history line
+ * [^P] [k]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
+{
+ char beep = 0;
+ int sv_event = el->el_history.eventno;
+
+ el->el_chared.c_undo.len = -1;
+ *el->el_line.lastchar = '\0'; /* just in case */
+
+ if (el->el_history.eventno == 0) { /* save the current buffer
+ * away */
+ (void) strncpy(el->el_history.buf, el->el_line.buffer,
+ EL_BUFSIZ);
+ el->el_history.last = el->el_history.buf +
+ (el->el_line.lastchar - el->el_line.buffer);
+ }
+ el->el_history.eventno += el->el_state.argument;
+
+ if (hist_get(el) == CC_ERROR) {
+ if (el->el_map.type == MAP_VI) {
+ el->el_history.eventno = sv_event;
+ return CC_ERROR;
+ }
+ beep = 1;
+ /* el->el_history.eventno was fixed by first call */
+ (void) hist_get(el);
+ }
+ if (beep)
+ return CC_REFRESH_BEEP;
+ return CC_REFRESH;
+}
+
+
+/* ed_next_history():
+ * Move to the next history line
+ * [^N] [j]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_next_history(EditLine *el, int c __attribute__((__unused__)))
+{
+ el_action_t beep = CC_REFRESH, rval;
+
+ el->el_chared.c_undo.len = -1;
+ *el->el_line.lastchar = '\0'; /* just in case */
+
+ el->el_history.eventno -= el->el_state.argument;
+
+ if (el->el_history.eventno < 0) {
+ el->el_history.eventno = 0;
+ beep = CC_REFRESH_BEEP;
+ }
+ rval = hist_get(el);
+ if (rval == CC_REFRESH)
+ return beep;
+ return rval;
+
+}
+
+
+/* ed_search_prev_history():
+ * Search previous in history for a line matching the current
+ * next search history [M-P] [K]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
+{
+ const char *hp;
+ int h;
+ bool_t found = 0;
+
+ el->el_chared.c_vcmd.action = NOP;
+ el->el_chared.c_undo.len = -1;
+ *el->el_line.lastchar = '\0'; /* just in case */
+ if (el->el_history.eventno < 0) {
+#ifdef DEBUG_EDIT
+ (void) fprintf(el->el_errfile,
+ "e_prev_search_hist(): eventno < 0;\n");
+#endif
+ el->el_history.eventno = 0;
+ return (CC_ERROR);
+ }
+ if (el->el_history.eventno == 0) {
+ (void) strncpy(el->el_history.buf, el->el_line.buffer,
+ EL_BUFSIZ);
+ el->el_history.last = el->el_history.buf +
+ (el->el_line.lastchar - el->el_line.buffer);
+ }
+ if (el->el_history.ref == NULL)
+ return (CC_ERROR);
+
+ hp = HIST_FIRST(el);
+ if (hp == NULL)
+ return (CC_ERROR);
+
+ c_setpat(el); /* Set search pattern !! */
+
+ for (h = 1; h <= el->el_history.eventno; h++)
+ hp = HIST_NEXT(el);
+
+ while (hp != NULL) {
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
+#endif
+ if ((strncmp(hp, el->el_line.buffer, (size_t)
+ (el->el_line.lastchar - el->el_line.buffer)) ||
+ hp[el->el_line.lastchar - el->el_line.buffer]) &&
+ c_hmatch(el, hp)) {
+ found++;
+ break;
+ }
+ h++;
+ hp = HIST_NEXT(el);
+ }
+
+ if (!found) {
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "not found\n");
+#endif
+ return (CC_ERROR);
+ }
+ el->el_history.eventno = h;
+
+ return (hist_get(el));
+}
+
+
+/* ed_search_next_history():
+ * Search next in history for a line matching the current
+ * [M-N] [J]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
+{
+ const char *hp;
+ int h;
+ bool_t found = 0;
+
+ el->el_chared.c_vcmd.action = NOP;
+ el->el_chared.c_undo.len = -1;
+ *el->el_line.lastchar = '\0'; /* just in case */
+
+ if (el->el_history.eventno == 0)
+ return (CC_ERROR);
+
+ if (el->el_history.ref == NULL)
+ return (CC_ERROR);
+
+ hp = HIST_FIRST(el);
+ if (hp == NULL)
+ return (CC_ERROR);
+
+ c_setpat(el); /* Set search pattern !! */
+
+ for (h = 1; h < el->el_history.eventno && hp; h++) {
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
+#endif
+ if ((strncmp(hp, el->el_line.buffer, (size_t)
+ (el->el_line.lastchar - el->el_line.buffer)) ||
+ hp[el->el_line.lastchar - el->el_line.buffer]) &&
+ c_hmatch(el, hp))
+ found = h;
+ hp = HIST_NEXT(el);
+ }
+
+ if (!found) { /* is it the current history number? */
+ if (!c_hmatch(el, el->el_history.buf)) {
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "not found\n");
+#endif
+ return (CC_ERROR);
+ }
+ }
+ el->el_history.eventno = found;
+
+ return (hist_get(el));
+}
+
+
+/* ed_prev_line():
+ * Move up one line
+ * Could be [k] [^p]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *ptr;
+ int nchars = c_hpos(el);
+
+ /*
+ * Move to the line requested
+ */
+ if (*(ptr = el->el_line.cursor) == '\n')
+ ptr--;
+
+ for (; ptr >= el->el_line.buffer; ptr--)
+ if (*ptr == '\n' && --el->el_state.argument <= 0)
+ break;
+
+ if (el->el_state.argument > 0)
+ return (CC_ERROR);
+
+ /*
+ * Move to the beginning of the line
+ */
+ for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--)
+ continue;
+
+ /*
+ * Move to the character requested
+ */
+ for (ptr++;
+ nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
+ ptr++)
+ continue;
+
+ el->el_line.cursor = ptr;
+ return (CC_CURSOR);
+}
+
+
+/* ed_next_line():
+ * Move down one line
+ * Could be [j] [^n]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_next_line(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *ptr;
+ int nchars = c_hpos(el);
+
+ /*
+ * Move to the line requested
+ */
+ for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++)
+ if (*ptr == '\n' && --el->el_state.argument <= 0)
+ break;
+
+ if (el->el_state.argument > 0)
+ return (CC_ERROR);
+
+ /*
+ * Move to the character requested
+ */
+ for (ptr++;
+ nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';
+ ptr++)
+ continue;
+
+ el->el_line.cursor = ptr;
+ return (CC_CURSOR);
+}
+
+
+/* ed_command():
+ * Editline extended command
+ * [M-X] [:]
+ */
+protected el_action_t
+/*ARGSUSED*/
+ed_command(EditLine *el, int c __attribute__((__unused__)))
+{
+ char tmpbuf[EL_BUFSIZ];
+ int tmplen;
+
+ tmplen = c_gets(el, tmpbuf, "\n: ");
+ term__putc('\n');
+
+ if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
+ term_beep(el);
+
+ el->el_map.current = el->el_map.key;
+ re_clear_display(el);
+ return CC_REFRESH;
+}
diff --git a/frontend/libedit/common.h b/frontend/libedit/common.h
new file mode 100644
index 0000000..35c61eb
--- /dev/null
+++ b/frontend/libedit/common.h
@@ -0,0 +1,39 @@
+/* Automatically generated file, do not edit */
+#ifndef _h_common_c
+#define _h_common_c
+protected el_action_t ed_end_of_file (EditLine *, int);
+protected el_action_t ed_insert (EditLine *, int);
+protected el_action_t ed_delete_prev_word (EditLine *, int);
+protected el_action_t ed_delete_next_char (EditLine *, int);
+protected el_action_t ed_kill_line (EditLine *, int);
+protected el_action_t ed_move_to_end (EditLine *, int);
+protected el_action_t ed_move_to_beg (EditLine *, int);
+protected el_action_t ed_transpose_chars (EditLine *, int);
+protected el_action_t ed_next_char (EditLine *, int);
+protected el_action_t ed_prev_word (EditLine *, int);
+protected el_action_t ed_prev_char (EditLine *, int);
+protected el_action_t ed_quoted_insert (EditLine *, int);
+protected el_action_t ed_digit (EditLine *, int);
+protected el_action_t ed_argument_digit (EditLine *, int);
+protected el_action_t ed_unassigned (EditLine *, int);
+protected el_action_t ed_tty_sigint (EditLine *, int);
+protected el_action_t ed_tty_dsusp (EditLine *, int);
+protected el_action_t ed_tty_flush_output (EditLine *, int);
+protected el_action_t ed_tty_sigquit (EditLine *, int);
+protected el_action_t ed_tty_sigtstp (EditLine *, int);
+protected el_action_t ed_tty_stop_output (EditLine *, int);
+protected el_action_t ed_tty_start_output (EditLine *, int);
+protected el_action_t ed_newline (EditLine *, int);
+protected el_action_t ed_delete_prev_char (EditLine *, int);
+protected el_action_t ed_clear_screen (EditLine *, int);
+protected el_action_t ed_redisplay (EditLine *, int);
+protected el_action_t ed_start_over (EditLine *, int);
+protected el_action_t ed_sequence_lead_in (EditLine *, int);
+protected el_action_t ed_prev_history (EditLine *, int);
+protected el_action_t ed_next_history (EditLine *, int);
+protected el_action_t ed_search_prev_history (EditLine *, int);
+protected el_action_t ed_search_next_history (EditLine *, int);
+protected el_action_t ed_prev_line (EditLine *, int);
+protected el_action_t ed_next_line (EditLine *, int);
+protected el_action_t ed_command (EditLine *, int);
+#endif /* _h_common_c */
diff --git a/frontend/libedit/el.c b/frontend/libedit/el.c
new file mode 100644
index 0000000..32ae4d7
--- /dev/null
+++ b/frontend/libedit/el.c
@@ -0,0 +1,528 @@
+/* $NetBSD: el.c,v 1.41 2005/08/19 04:21:47 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * el.c: EditLine interface functions
+ */
+#include <sys/types.h>
+#include <sys/param.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "el.h"
+
+/* el_init():
+ * Initialize editline and set default parameters.
+ */
+public EditLine *
+el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
+{
+
+ EditLine *el = (EditLine *) el_malloc(sizeof(EditLine));
+
+ if (el == NULL)
+ return (NULL);
+
+ memset(el, 0, sizeof(EditLine));
+
+ el->el_infd = fileno(fin);
+ el->el_outfile = fout;
+ el->el_errfile = ferr;
+ if ((el->el_prog = el_strdup(prog)) == NULL) {
+ el_free(el);
+ return NULL;
+ }
+
+ /*
+ * Initialize all the modules. Order is important!!!
+ */
+ el->el_flags = 0;
+
+ if (term_init(el) == -1) {
+ el_free(el->el_prog);
+ el_free(el);
+ return NULL;
+ }
+ (void) key_init(el);
+ (void) map_init(el);
+ if (tty_init(el) == -1)
+ el->el_flags |= NO_TTY;
+ (void) ch_init(el);
+ (void) search_init(el);
+ (void) hist_init(el);
+ (void) prompt_init(el);
+ (void) sig_init(el);
+ (void) read_init(el);
+
+ return (el);
+}
+
+
+/* el_end():
+ * Clean up.
+ */
+public void
+el_end(EditLine *el)
+{
+
+ if (el == NULL)
+ return;
+
+ el_reset(el);
+
+ term_end(el);
+ key_end(el);
+ map_end(el);
+ tty_end(el);
+ ch_end(el);
+ search_end(el);
+ hist_end(el);
+ prompt_end(el);
+ sig_end(el);
+
+ el_free((ptr_t) el->el_prog);
+ el_free((ptr_t) el);
+}
+
+
+/* el_reset():
+ * Reset the tty and the parser
+ */
+public void
+el_reset(EditLine *el)
+{
+
+ tty_cookedmode(el);
+ ch_reset(el, 0); /* XXX: Do we want that? */
+}
+
+
+/* el_set():
+ * set the editline parameters
+ */
+public int
+el_set(EditLine *el, int op, ...)
+{
+ va_list va;
+ int rv = 0;
+
+ if (el == NULL)
+ return (-1);
+ va_start(va, op);
+
+ switch (op) {
+ case EL_PROMPT:
+ case EL_RPROMPT:
+ rv = prompt_set(el, va_arg(va, el_pfunc_t), op);
+ break;
+
+ case EL_TERMINAL:
+ rv = term_set(el, va_arg(va, char *));
+ break;
+
+ case EL_EDITOR:
+ rv = map_set_editor(el, va_arg(va, char *));
+ break;
+
+ case EL_SIGNAL:
+ if (va_arg(va, int))
+ el->el_flags |= HANDLE_SIGNALS;
+ else
+ el->el_flags &= ~HANDLE_SIGNALS;
+ break;
+
+ case EL_BIND:
+ case EL_TELLTC:
+ case EL_SETTC:
+ case EL_ECHOTC:
+ case EL_SETTY:
+ {
+ const char *argv[20];
+ int i;
+
+ for (i = 1; i < 20; i++)
+ if ((argv[i] = va_arg(va, char *)) == NULL)
+ break;
+
+ switch (op) {
+ case EL_BIND:
+ argv[0] = "bind";
+ rv = map_bind(el, i, argv);
+ break;
+
+ case EL_TELLTC:
+ argv[0] = "telltc";
+ rv = term_telltc(el, i, argv);
+ break;
+
+ case EL_SETTC:
+ argv[0] = "settc";
+ rv = term_settc(el, i, argv);
+ break;
+
+ case EL_ECHOTC:
+ argv[0] = "echotc";
+ rv = term_echotc(el, i, argv);
+ break;
+
+ case EL_SETTY:
+ argv[0] = "setty";
+ rv = tty_stty(el, i, argv);
+ break;
+
+ default:
+ rv = -1;
+ EL_ABORT((el->el_errfile, "Bad op %d\n", op));
+ break;
+ }
+ break;
+ }
+
+ case EL_ADDFN:
+ {
+ char *name = va_arg(va, char *);
+ char *help = va_arg(va, char *);
+ el_func_t func = va_arg(va, el_func_t);
+
+ rv = map_addfunc(el, name, help, func);
+ break;
+ }
+
+ case EL_HIST:
+ {
+ hist_fun_t func = va_arg(va, hist_fun_t);
+ ptr_t ptr = va_arg(va, char *);
+
+ rv = hist_set(el, func, ptr);
+ break;
+ }
+
+ case EL_EDITMODE:
+ if (va_arg(va, int))
+ el->el_flags &= ~EDIT_DISABLED;
+ else
+ el->el_flags |= EDIT_DISABLED;
+ rv = 0;
+ break;
+
+ case EL_GETCFN:
+ {
+ el_rfunc_t rc = va_arg(va, el_rfunc_t);
+ rv = el_read_setfn(el, rc);
+ break;
+ }
+
+ case EL_CLIENTDATA:
+ el->el_data = va_arg(va, void *);
+ break;
+
+ case EL_UNBUFFERED:
+ rv = va_arg(va, int);
+ if (rv && !(el->el_flags & UNBUFFERED)) {
+ el->el_flags |= UNBUFFERED;
+ read_prepare(el);
+ } else if (!rv && (el->el_flags & UNBUFFERED)) {
+ el->el_flags &= ~UNBUFFERED;
+ read_finish(el);
+ }
+ rv = 0;
+ break;
+
+ case EL_PREP_TERM:
+ rv = va_arg(va, int);
+ if (rv)
+ (void) tty_rawmode(el);
+ else
+ (void) tty_cookedmode(el);
+ rv = 0;
+ break;
+
+ default:
+ rv = -1;
+ break;
+ }
+
+ va_end(va);
+ return (rv);
+}
+
+
+/* el_get():
+ * retrieve the editline parameters
+ */
+public int
+el_get(EditLine *el, int op, void *ret)
+{
+ int rv;
+
+ if (el == NULL || ret == NULL)
+ return (-1);
+ switch (op) {
+ case EL_PROMPT:
+ case EL_RPROMPT:
+ rv = prompt_get(el, (el_pfunc_t *) ret, op);
+ break;
+
+ case EL_EDITOR:
+ rv = map_get_editor(el, (const char **)ret);
+ break;
+
+ case EL_SIGNAL:
+ *((int *) ret) = (el->el_flags & HANDLE_SIGNALS);
+ rv = 0;
+ break;
+
+ case EL_EDITMODE:
+ *((int *) ret) = (!(el->el_flags & EDIT_DISABLED));
+ rv = 0;
+ break;
+
+ case EL_TERMINAL:
+ term_get(el, (const char **)ret);
+ rv = 0;
+ break;
+
+#if 0 /* XXX */
+ case EL_BIND:
+ case EL_TELLTC:
+ case EL_SETTC:
+ case EL_ECHOTC:
+ case EL_SETTY:
+ {
+ const char *argv[20];
+ int i;
+
+ for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++)
+ if ((argv[i] = va_arg(va, char *)) == NULL)
+ break;
+
+ switch (op) {
+ case EL_BIND:
+ argv[0] = "bind";
+ rv = map_bind(el, i, argv);
+ break;
+
+ case EL_TELLTC:
+ argv[0] = "telltc";
+ rv = term_telltc(el, i, argv);
+ break;
+
+ case EL_SETTC:
+ argv[0] = "settc";
+ rv = term_settc(el, i, argv);
+ break;
+
+ case EL_ECHOTC:
+ argv[0] = "echotc";
+ rv = term_echotc(el, i, argv);
+ break;
+
+ case EL_SETTY:
+ argv[0] = "setty";
+ rv = tty_stty(el, i, argv);
+ break;
+
+ default:
+ rv = -1;
+ EL_ABORT((el->errfile, "Bad op %d\n", op));
+ break;
+ }
+ break;
+ }
+
+ case EL_ADDFN:
+ {
+ char *name = va_arg(va, char *);
+ char *help = va_arg(va, char *);
+ el_func_t func = va_arg(va, el_func_t);
+
+ rv = map_addfunc(el, name, help, func);
+ break;
+ }
+
+ case EL_HIST:
+ {
+ hist_fun_t func = va_arg(va, hist_fun_t);
+ ptr_t ptr = va_arg(va, char *);
+ rv = hist_set(el, func, ptr);
+ }
+ break;
+#endif /* XXX */
+
+ case EL_GETCFN:
+ *((el_rfunc_t *)ret) = el_read_getfn(el);
+ rv = 0;
+ break;
+
+ case EL_CLIENTDATA:
+ *((void **)ret) = el->el_data;
+ rv = 0;
+ break;
+
+ case EL_UNBUFFERED:
+ *((int *) ret) = (!(el->el_flags & UNBUFFERED));
+ rv = 0;
+ break;
+
+ default:
+ rv = -1;
+ }
+
+ return (rv);
+}
+
+
+/* el_line():
+ * Return editing info
+ */
+public const LineInfo *
+el_line(EditLine *el)
+{
+
+ return (const LineInfo *) (void *) &el->el_line;
+}
+
+
+/* el_source():
+ * Source a file
+ */
+public int
+el_source(EditLine *el, const char *fname)
+{
+ FILE *fp;
+ size_t len;
+ char *ptr;
+
+ fp = NULL;
+ if (fname == NULL) {
+ static const char elpath[] = "/.editrc";
+#ifdef MAXPATHLEN
+ char path[MAXPATHLEN];
+#else
+ char path[4096];
+#endif
+
+#ifdef HAVE_ISSETUGID
+ if (issetugid())
+ return (-1);
+#endif
+ if ((ptr = getenv("HOME")) == NULL)
+ return (-1);
+ if (strlcpy(path, ptr, sizeof(path)) >= sizeof(path))
+ return (-1);
+ if (strlcat(path, elpath, sizeof(path)) >= sizeof(path))
+ return (-1);
+ fname = path;
+ }
+ if (fp == NULL)
+ fp = fopen(fname, "r");
+ if (fp == NULL)
+ return (-1);
+
+ while ((ptr = fgetln(fp, &len)) != NULL) {
+ if (len > 0 && ptr[len - 1] == '\n')
+ --len;
+ ptr[len] = '\0';
+ if (parse_line(el, ptr) == -1) {
+ (void) fclose(fp);
+ return (-1);
+ }
+ }
+
+ (void) fclose(fp);
+ return (0);
+}
+
+
+/* el_resize():
+ * Called from program when terminal is resized
+ */
+public void
+el_resize(EditLine *el)
+{
+ int lins, cols;
+ sigset_t oset, nset;
+
+ (void) sigemptyset(&nset);
+ (void) sigaddset(&nset, SIGWINCH);
+ (void) sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ /* get the correct window size */
+ if (term_get_size(el, &lins, &cols))
+ term_change_size(el, lins, cols);
+
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+}
+
+
+/* el_beep():
+ * Called from the program to beep
+ */
+public void
+el_beep(EditLine *el)
+{
+
+ term_beep(el);
+}
+
+
+/* el_editmode()
+ * Set the state of EDIT_DISABLED from the `edit' command.
+ */
+protected int
+/*ARGSUSED*/
+el_editmode(EditLine *el, int argc, const char **argv)
+{
+ const char *how;
+
+ if (argv == NULL || argc != 2 || argv[1] == NULL)
+ return (-1);
+
+ how = argv[1];
+ if (strcmp(how, "on") == 0) {
+ el->el_flags &= ~EDIT_DISABLED;
+ tty_rawmode(el);
+ } else if (strcmp(how, "off") == 0) {
+ tty_cookedmode(el);
+ el->el_flags |= EDIT_DISABLED;
+ }
+ else {
+ (void) fprintf(el->el_errfile, "edit: Bad value `%s'.\n", how);
+ return (-1);
+ }
+ return (0);
+}
diff --git a/frontend/libedit/el.h b/frontend/libedit/el.h
new file mode 100644
index 0000000..c4b6cff
--- /dev/null
+++ b/frontend/libedit/el.h
@@ -0,0 +1,149 @@
+/* $NetBSD: el.h,v 1.16 2003/10/18 23:48:42 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)el.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.h: Internal structures.
+ */
+#ifndef _h_el
+#define _h_el
+/*
+ * Local defaults
+ */
+#define KSHVI
+#define VIDEFAULT
+#define ANCHOR
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#define EL_BUFSIZ 1024 /* Maximum line size */
+
+#define HANDLE_SIGNALS 0x01
+#define NO_TTY 0x02
+#define EDIT_DISABLED 0x04
+#define UNBUFFERED 0x08
+
+typedef int bool_t; /* True or not */
+
+typedef unsigned char el_action_t; /* Index to command array */
+
+typedef struct coord_t { /* Position on the screen */
+ int h;
+ int v;
+} coord_t;
+
+typedef struct el_line_t {
+ char *buffer; /* Input line */
+ char *cursor; /* Cursor position */
+ char *lastchar; /* Last character */
+ const char *limit; /* Max position */
+} el_line_t;
+
+/*
+ * Editor state
+ */
+typedef struct el_state_t {
+ int inputmode; /* What mode are we in? */
+ int doingarg; /* Are we getting an argument? */
+ int argument; /* Numeric argument */
+ int metanext; /* Is the next char a meta char */
+ el_action_t lastcmd; /* Previous command */
+ el_action_t thiscmd; /* this command */
+ char thisch; /* char that generated it */
+} el_state_t;
+
+/*
+ * Until we come up with something better...
+ */
+#define el_strdup(a) strdup(a)
+#define el_malloc(a) malloc(a)
+#define el_realloc(a,b) realloc(a, b)
+#define el_free(a) free(a)
+
+#include "tty.h"
+#include "prompt.h"
+#include "key.h"
+#include "el_term.h"
+#include "refresh.h"
+#include "chared.h"
+#include "common.h"
+#include "search.h"
+#include "hist.h"
+#include "map.h"
+#include "parse.h"
+#include "sig.h"
+#include "help.h"
+#include "read.h"
+
+struct editline {
+ char *el_prog; /* the program name */
+ FILE *el_outfile; /* Stdio stuff */
+ FILE *el_errfile; /* Stdio stuff */
+ int el_infd; /* Input file descriptor */
+ int el_flags; /* Various flags. */
+ coord_t el_cursor; /* Cursor location */
+ char **el_display; /* Real screen image = what is there */
+ char **el_vdisplay; /* Virtual screen image = what we see */
+ void *el_data; /* Client data */
+ el_line_t el_line; /* The current line information */
+ el_state_t el_state; /* Current editor state */
+ el_term_t el_term; /* Terminal dependent stuff */
+ el_tty_t el_tty; /* Tty dependent stuff */
+ el_refresh_t el_refresh; /* Refresh stuff */
+ el_prompt_t el_prompt; /* Prompt stuff */
+ el_prompt_t el_rprompt; /* Prompt stuff */
+ el_chared_t el_chared; /* Characted editor stuff */
+ el_map_t el_map; /* Key mapping stuff */
+ el_key_t el_key; /* Key binding stuff */
+ el_history_t el_history; /* History stuff */
+ el_search_t el_search; /* Search stuff */
+ el_signal_t el_signal; /* Signal handling stuff */
+ el_read_t el_read; /* Character reading stuff */
+};
+
+protected int el_editmode(EditLine *, int, const char **);
+
+#ifdef DEBUG
+#define EL_ABORT(a) do { \
+ fprintf(el->el_errfile, "%s, %d: ", \
+ __FILE__, __LINE__); \
+ fprintf a; \
+ abort(); \
+ } while( /*CONSTCOND*/0);
+#else
+#define EL_ABORT(a) abort()
+#endif
+#endif /* _h_el */
diff --git a/frontend/libedit/el_term.h b/frontend/libedit/el_term.h
new file mode 100644
index 0000000..fb51363
--- /dev/null
+++ b/frontend/libedit/el_term.h
@@ -0,0 +1,133 @@
+/* $NetBSD: term.h,v 1.17 2006/03/06 21:11:56 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)term.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.term.h: Termcap header
+ */
+#ifndef _h_el_term
+#define _h_el_term
+
+#include "histedit.h"
+
+typedef struct { /* Symbolic function key bindings */
+ const char *name; /* name of the key */
+ int key; /* Index in termcap table */
+ key_value_t fun; /* Function bound to it */
+ int type; /* Type of function */
+} fkey_t;
+
+typedef struct {
+ const char *t_name; /* the terminal name */
+ coord_t t_size; /* # lines and cols */
+ int t_flags;
+#define TERM_CAN_INSERT 0x001 /* Has insert cap */
+#define TERM_CAN_DELETE 0x002 /* Has delete cap */
+#define TERM_CAN_CEOL 0x004 /* Has CEOL cap */
+#define TERM_CAN_TAB 0x008 /* Can use tabs */
+#define TERM_CAN_ME 0x010 /* Can turn all attrs. */
+#define TERM_CAN_UP 0x020 /* Can move up */
+#define TERM_HAS_META 0x040 /* Has a meta key */
+#define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */
+#define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */
+ char *t_buf; /* Termcap buffer */
+ int t_loc; /* location used */
+ char **t_str; /* termcap strings */
+ int *t_val; /* termcap values */
+ char *t_cap; /* Termcap buffer */
+ fkey_t *t_fkey; /* Array of keys */
+} el_term_t;
+
+/*
+ * fKey indexes
+ */
+#define A_K_DN 0
+#define A_K_UP 1
+#define A_K_LT 2
+#define A_K_RT 3
+#define A_K_HO 4
+#define A_K_EN 5
+#define A_K_NKEYS 6
+
+#ifdef _SUNOS
+extern int tgetent(char *, const char *);
+extern int tgetflag(char *);
+extern int tgetnum(char *);
+extern int tputs(const char *, int, int (*)(int));
+extern char* tgoto(const char*, int, int);
+extern char* tgetstr(char*, char**);
+#endif
+
+protected void term_move_to_line(EditLine *, int);
+protected void term_move_to_char(EditLine *, int);
+protected void term_clear_EOL(EditLine *, int);
+protected void term_overwrite(EditLine *, const char *, int);
+protected void term_insertwrite(EditLine *, char *, int);
+protected void term_deletechars(EditLine *, int);
+protected void term_clear_screen(EditLine *);
+protected void term_beep(EditLine *);
+protected int term_change_size(EditLine *, int, int);
+protected int term_get_size(EditLine *, int *, int *);
+protected int term_init(EditLine *);
+protected void term_bind_arrow(EditLine *);
+protected void term_print_arrow(EditLine *, const char *);
+protected int term_clear_arrow(EditLine *, const char *);
+protected int term_set_arrow(EditLine *, const char *, key_value_t *, int);
+protected void term_end(EditLine *);
+protected void term_get(EditLine *, const char **);
+protected int term_set(EditLine *, const char *);
+protected int term_settc(EditLine *, int, const char **);
+protected int term_telltc(EditLine *, int, const char **);
+protected int term_echotc(EditLine *, int, const char **);
+protected void term_writec(EditLine *, int);
+protected int term__putc(int);
+protected void term__flush(void);
+
+/*
+ * Easy access macros
+ */
+#define EL_FLAGS (el)->el_term.t_flags
+
+#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT)
+#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE)
+#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL)
+#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB)
+#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME)
+#define EL_CAN_UP (EL_FLAGS & TERM_CAN_UP)
+#define EL_HAS_META (EL_FLAGS & TERM_HAS_META)
+#define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS)
+#define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS)
+
+#endif /* _h_el_term */
diff --git a/frontend/libedit/emacs.c b/frontend/libedit/emacs.c
new file mode 100644
index 0000000..81711d3
--- /dev/null
+++ b/frontend/libedit/emacs.c
@@ -0,0 +1,501 @@
+/* $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * emacs.c: Emacs functions
+ */
+#include "el.h"
+
+/* em_delete_or_list():
+ * Delete character under cursor or list completions if at end of line
+ * [^D]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_delete_or_list(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor == el->el_line.lastchar) {
+ /* if I'm at the end */
+ if (el->el_line.cursor == el->el_line.buffer) {
+ /* and the beginning */
+ term_writec(el, c); /* then do an EOF */
+ return (CC_EOF);
+ } else {
+ /*
+ * Here we could list completions, but it is an
+ * error right now
+ */
+ term_beep(el);
+ return (CC_ERROR);
+ }
+ } else {
+ if (el->el_state.doingarg)
+ c_delafter(el, el->el_state.argument);
+ else
+ c_delafter1(el);
+ if (el->el_line.cursor > el->el_line.lastchar)
+ el->el_line.cursor = el->el_line.lastchar;
+ /* bounds check */
+ return (CC_REFRESH);
+ }
+}
+
+
+/* em_delete_next_word():
+ * Cut from cursor to end of current word
+ * [M-d]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_delete_next_word(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp, *p, *kp;
+
+ if (el->el_line.cursor == el->el_line.lastchar)
+ return (CC_ERROR);
+
+ cp = c__next_word(el->el_line.cursor, el->el_line.lastchar,
+ el->el_state.argument, ce__isword);
+
+ for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++)
+ /* save the text */
+ *kp++ = *p;
+ el->el_chared.c_kill.last = kp;
+
+ c_delafter(el, cp - el->el_line.cursor); /* delete after dot */
+ if (el->el_line.cursor > el->el_line.lastchar)
+ el->el_line.cursor = el->el_line.lastchar;
+ /* bounds check */
+ return (CC_REFRESH);
+}
+
+
+/* em_yank():
+ * Paste cut buffer at cursor position
+ * [^Y]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_yank(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *kp, *cp;
+
+ if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf)
+ return (CC_NORM);
+
+ if (el->el_line.lastchar +
+ (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >=
+ el->el_line.limit)
+ return (CC_ERROR);
+
+ el->el_chared.c_kill.mark = el->el_line.cursor;
+ cp = el->el_line.cursor;
+
+ /* open the space, */
+ c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf);
+ /* copy the chars */
+ for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++)
+ *cp++ = *kp;
+
+ /* if an arg, cursor at beginning else cursor at end */
+ if (el->el_state.argument == 1)
+ el->el_line.cursor = cp;
+
+ return (CC_REFRESH);
+}
+
+
+/* em_kill_line():
+ * Cut the entire line and save in cut buffer
+ * [^U]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_kill_line(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *kp, *cp;
+
+ cp = el->el_line.buffer;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_line.lastchar)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ /* zap! -- delete all of it */
+ el->el_line.lastchar = el->el_line.buffer;
+ el->el_line.cursor = el->el_line.buffer;
+ return (CC_REFRESH);
+}
+
+
+/* em_kill_region():
+ * Cut area between mark and cursor and save in cut buffer
+ * [^W]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_kill_region(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *kp, *cp;
+
+ if (!el->el_chared.c_kill.mark)
+ return (CC_ERROR);
+
+ if (el->el_chared.c_kill.mark > el->el_line.cursor) {
+ cp = el->el_line.cursor;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_chared.c_kill.mark)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ c_delafter(el, cp - el->el_line.cursor);
+ } else { /* mark is before cursor */
+ cp = el->el_chared.c_kill.mark;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_line.cursor)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ c_delbefore(el, cp - el->el_chared.c_kill.mark);
+ el->el_line.cursor = el->el_chared.c_kill.mark;
+ }
+ return (CC_REFRESH);
+}
+
+
+/* em_copy_region():
+ * Copy area between mark and cursor to cut buffer
+ * [M-W]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_copy_region(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *kp, *cp;
+
+ if (!el->el_chared.c_kill.mark)
+ return (CC_ERROR);
+
+ if (el->el_chared.c_kill.mark > el->el_line.cursor) {
+ cp = el->el_line.cursor;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_chared.c_kill.mark)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ } else {
+ cp = el->el_chared.c_kill.mark;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_line.cursor)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ }
+ return (CC_NORM);
+}
+
+
+/* em_gosmacs_transpose():
+ * Exchange the two characters before the cursor
+ * Gosling emacs transpose chars [^T]
+ */
+protected el_action_t
+em_gosmacs_transpose(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor > &el->el_line.buffer[1]) {
+ /* must have at least two chars entered */
+ c = el->el_line.cursor[-2];
+ el->el_line.cursor[-2] = el->el_line.cursor[-1];
+ el->el_line.cursor[-1] = c;
+ return (CC_REFRESH);
+ } else
+ return (CC_ERROR);
+}
+
+
+/* em_next_word():
+ * Move next to end of current word
+ * [M-f]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_next_word(EditLine *el, int c __attribute__((__unused__)))
+{
+ if (el->el_line.cursor == el->el_line.lastchar)
+ return (CC_ERROR);
+
+ el->el_line.cursor = c__next_word(el->el_line.cursor,
+ el->el_line.lastchar,
+ el->el_state.argument,
+ ce__isword);
+
+ if (el->el_map.type == MAP_VI)
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* em_upper_case():
+ * Uppercase the characters from cursor to end of current word
+ * [M-u]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_upper_case(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp, *ep;
+
+ ep = c__next_word(el->el_line.cursor, el->el_line.lastchar,
+ el->el_state.argument, ce__isword);
+
+ for (cp = el->el_line.cursor; cp < ep; cp++)
+ if (islower((unsigned char)*cp))
+ *cp = toupper((unsigned char)*cp);
+
+ el->el_line.cursor = ep;
+ if (el->el_line.cursor > el->el_line.lastchar)
+ el->el_line.cursor = el->el_line.lastchar;
+ return (CC_REFRESH);
+}
+
+
+/* em_capitol_case():
+ * Capitalize the characters from cursor to end of current word
+ * [M-c]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_capitol_case(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp, *ep;
+
+ ep = c__next_word(el->el_line.cursor, el->el_line.lastchar,
+ el->el_state.argument, ce__isword);
+
+ for (cp = el->el_line.cursor; cp < ep; cp++) {
+ if (isalpha((unsigned char)*cp)) {
+ if (islower((unsigned char)*cp))
+ *cp = toupper((unsigned char)*cp);
+ cp++;
+ break;
+ }
+ }
+ for (; cp < ep; cp++)
+ if (isupper((unsigned char)*cp))
+ *cp = tolower((unsigned char)*cp);
+
+ el->el_line.cursor = ep;
+ if (el->el_line.cursor > el->el_line.lastchar)
+ el->el_line.cursor = el->el_line.lastchar;
+ return (CC_REFRESH);
+}
+
+
+/* em_lower_case():
+ * Lowercase the characters from cursor to end of current word
+ * [M-l]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_lower_case(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp, *ep;
+
+ ep = c__next_word(el->el_line.cursor, el->el_line.lastchar,
+ el->el_state.argument, ce__isword);
+
+ for (cp = el->el_line.cursor; cp < ep; cp++)
+ if (isupper((unsigned char)*cp))
+ *cp = tolower((unsigned char)*cp);
+
+ el->el_line.cursor = ep;
+ if (el->el_line.cursor > el->el_line.lastchar)
+ el->el_line.cursor = el->el_line.lastchar;
+ return (CC_REFRESH);
+}
+
+
+/* em_set_mark():
+ * Set the mark at cursor
+ * [^@]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_set_mark(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_chared.c_kill.mark = el->el_line.cursor;
+ return (CC_NORM);
+}
+
+
+/* em_exchange_mark():
+ * Exchange the cursor and mark
+ * [^X^X]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_exchange_mark(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp;
+
+ cp = el->el_line.cursor;
+ el->el_line.cursor = el->el_chared.c_kill.mark;
+ el->el_chared.c_kill.mark = cp;
+ return (CC_CURSOR);
+}
+
+
+/* em_universal_argument():
+ * Universal argument (argument times 4)
+ * [^U]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_universal_argument(EditLine *el, int c __attribute__((__unused__)))
+{ /* multiply current argument by 4 */
+
+ if (el->el_state.argument > 1000000)
+ return (CC_ERROR);
+ el->el_state.doingarg = 1;
+ el->el_state.argument *= 4;
+ return (CC_ARGHACK);
+}
+
+
+/* em_meta_next():
+ * Add 8th bit to next character typed
+ * [<ESC>]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_meta_next(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_state.metanext = 1;
+ return (CC_ARGHACK);
+}
+
+
+/* em_toggle_overwrite():
+ * Switch from insert to overwrite mode or vice versa
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_toggle_overwrite(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ?
+ MODE_REPLACE : MODE_INSERT;
+ return (CC_NORM);
+}
+
+
+/* em_copy_prev_word():
+ * Copy current word to cursor
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_copy_prev_word(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *cp, *oldc, *dp;
+
+ if (el->el_line.cursor == el->el_line.buffer)
+ return (CC_ERROR);
+
+ oldc = el->el_line.cursor;
+ /* does a bounds check */
+ cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
+ el->el_state.argument, ce__isword);
+
+ c_insert(el, oldc - cp);
+ for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++)
+ *dp++ = *cp;
+
+ el->el_line.cursor = dp;/* put cursor at end */
+
+ return (CC_REFRESH);
+}
+
+
+/* em_inc_search_next():
+ * Emacs incremental next search
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_inc_search_next(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_search.patlen = 0;
+ return (ce_inc_search(el, ED_SEARCH_NEXT_HISTORY));
+}
+
+
+/* em_inc_search_prev():
+ * Emacs incremental reverse search
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_inc_search_prev(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_search.patlen = 0;
+ return (ce_inc_search(el, ED_SEARCH_PREV_HISTORY));
+}
+
+
+/* em_delete_prev_char():
+ * Delete the character to the left of the cursor
+ * [^?]
+ */
+protected el_action_t
+/*ARGSUSED*/
+em_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor <= el->el_line.buffer)
+ return (CC_ERROR);
+
+ if (el->el_state.doingarg)
+ c_delbefore(el, el->el_state.argument);
+ else
+ c_delbefore1(el);
+ el->el_line.cursor -= el->el_state.argument;
+ if (el->el_line.cursor < el->el_line.buffer)
+ el->el_line.cursor = el->el_line.buffer;
+ return (CC_REFRESH);
+}
diff --git a/frontend/libedit/emacs.h b/frontend/libedit/emacs.h
new file mode 100644
index 0000000..764f60f
--- /dev/null
+++ b/frontend/libedit/emacs.h
@@ -0,0 +1,23 @@
+/* Automatically generated file, do not edit */
+#ifndef _h_emacs_c
+#define _h_emacs_c
+protected el_action_t em_delete_or_list (EditLine *, int);
+protected el_action_t em_delete_next_word (EditLine *, int);
+protected el_action_t em_yank (EditLine *, int);
+protected el_action_t em_kill_line (EditLine *, int);
+protected el_action_t em_kill_region (EditLine *, int);
+protected el_action_t em_copy_region (EditLine *, int);
+protected el_action_t em_gosmacs_transpose (EditLine *, int);
+protected el_action_t em_next_word (EditLine *, int);
+protected el_action_t em_upper_case (EditLine *, int);
+protected el_action_t em_capitol_case (EditLine *, int);
+protected el_action_t em_lower_case (EditLine *, int);
+protected el_action_t em_set_mark (EditLine *, int);
+protected el_action_t em_exchange_mark (EditLine *, int);
+protected el_action_t em_universal_argument (EditLine *, int);
+protected el_action_t em_meta_next (EditLine *, int);
+protected el_action_t em_toggle_overwrite (EditLine *, int);
+protected el_action_t em_copy_prev_word (EditLine *, int);
+protected el_action_t em_inc_search_next (EditLine *, int);
+protected el_action_t em_inc_search_prev (EditLine *, int);
+#endif /* _h_emacs_c */
diff --git a/frontend/libedit/fcns.c b/frontend/libedit/fcns.c
new file mode 100644
index 0000000..8d9a531
--- /dev/null
+++ b/frontend/libedit/fcns.c
@@ -0,0 +1,58 @@
+/* Automatically generated file, do not edit */
+#include "sys.h"
+#include "el.h"
+private const el_func_t el_func[] = {
+ ed_argument_digit, ed_clear_screen,
+ ed_command, ed_delete_next_char,
+ ed_delete_prev_char, ed_delete_prev_word,
+ ed_digit, ed_end_of_file,
+ ed_insert, ed_kill_line,
+ ed_move_to_beg, ed_move_to_end,
+ ed_newline, ed_next_char,
+ ed_next_history, ed_next_line,
+ ed_prev_char, ed_prev_history,
+ ed_prev_line, ed_prev_word,
+ ed_quoted_insert, ed_redisplay,
+ ed_search_next_history, ed_search_prev_history,
+ ed_sequence_lead_in, ed_start_over,
+ ed_transpose_chars, ed_tty_dsusp,
+ ed_tty_flush_output, ed_tty_sigint,
+ ed_tty_sigquit, ed_tty_sigtstp,
+ ed_tty_start_output, ed_tty_stop_output,
+ ed_unassigned, em_capitol_case,
+ em_copy_prev_word, em_copy_region,
+ em_delete_next_word, em_delete_or_list,
+ em_exchange_mark, em_gosmacs_transpose,
+ em_inc_search_next, em_inc_search_prev,
+ em_kill_line, em_kill_region,
+ em_lower_case, em_meta_next,
+ em_next_word, em_set_mark,
+ em_toggle_overwrite, em_universal_argument,
+ em_upper_case, em_yank,
+ vi_add, vi_add_at_eol,
+ vi_alias, vi_change_case,
+ vi_change_meta, vi_change_to_eol,
+ vi_command_mode, vi_comment_out,
+ vi_delete_meta, vi_delete_prev_char,
+ vi_end_big_word, vi_end_word,
+ vi_histedit, vi_history_word,
+ vi_insert, vi_insert_at_bol,
+ vi_kill_line_prev, vi_list_or_eof,
+ vi_match, vi_next_big_word,
+ vi_next_char, vi_next_word,
+ vi_paste_next, vi_paste_prev,
+ vi_prev_big_word, vi_prev_char,
+ vi_prev_word, vi_redo,
+ vi_repeat_next_char, vi_repeat_prev_char,
+ vi_repeat_search_next, vi_repeat_search_prev,
+ vi_replace_char, vi_replace_mode,
+ vi_search_next, vi_search_prev,
+ vi_substitute_char, vi_substitute_line,
+ vi_to_column, vi_to_history_line,
+ vi_to_next_char, vi_to_prev_char,
+ vi_undo, vi_undo_line,
+ vi_yank, vi_yank_end,
+ vi_zero,
+};
+
+protected const el_func_t* func__get() { return el_func; }
diff --git a/frontend/libedit/fcns.h b/frontend/libedit/fcns.h
new file mode 100644
index 0000000..99ae88c
--- /dev/null
+++ b/frontend/libedit/fcns.h
@@ -0,0 +1,108 @@
+/* Automatically generated file, do not edit */
+#ifndef _h_fcns_c
+#define _h_fcns_c
+#define ED_ARGUMENT_DIGIT 0
+#define ED_CLEAR_SCREEN 1
+#define ED_COMMAND 2
+#define ED_DELETE_NEXT_CHAR 3
+#define ED_DELETE_PREV_CHAR 4
+#define ED_DELETE_PREV_WORD 5
+#define ED_DIGIT 6
+#define ED_END_OF_FILE 7
+#define ED_INSERT 8
+#define ED_KILL_LINE 9
+#define ED_MOVE_TO_BEG 10
+#define ED_MOVE_TO_END 11
+#define ED_NEWLINE 12
+#define ED_NEXT_CHAR 13
+#define ED_NEXT_HISTORY 14
+#define ED_NEXT_LINE 15
+#define ED_PREV_CHAR 16
+#define ED_PREV_HISTORY 17
+#define ED_PREV_LINE 18
+#define ED_PREV_WORD 19
+#define ED_QUOTED_INSERT 20
+#define ED_REDISPLAY 21
+#define ED_SEARCH_NEXT_HISTORY 22
+#define ED_SEARCH_PREV_HISTORY 23
+#define ED_SEQUENCE_LEAD_IN 24
+#define ED_START_OVER 25
+#define ED_TRANSPOSE_CHARS 26
+#define ED_TTY_DSUSP 27
+#define ED_TTY_FLUSH_OUTPUT 28
+#define ED_TTY_SIGINT 29
+#define ED_TTY_SIGQUIT 30
+#define ED_TTY_SIGTSTP 31
+#define ED_TTY_START_OUTPUT 32
+#define ED_TTY_STOP_OUTPUT 33
+#define ED_UNASSIGNED 34
+#define EM_CAPITOL_CASE 35
+#define EM_COPY_PREV_WORD 36
+#define EM_COPY_REGION 37
+#define EM_DELETE_NEXT_WORD 38
+#define EM_DELETE_OR_LIST 39
+#define EM_EXCHANGE_MARK 40
+#define EM_GOSMACS_TRANSPOSE 41
+#define EM_INC_SEARCH_NEXT 42
+#define EM_INC_SEARCH_PREV 43
+#define EM_KILL_LINE 44
+#define EM_KILL_REGION 45
+#define EM_LOWER_CASE 46
+#define EM_META_NEXT 47
+#define EM_NEXT_WORD 48
+#define EM_SET_MARK 49
+#define EM_TOGGLE_OVERWRITE 50
+#define EM_UNIVERSAL_ARGUMENT 51
+#define EM_UPPER_CASE 52
+#define EM_YANK 53
+#define VI_ADD 54
+#define VI_ADD_AT_EOL 55
+#define VI_ALIAS 56
+#define VI_CHANGE_CASE 57
+#define VI_CHANGE_META 58
+#define VI_CHANGE_TO_EOL 59
+#define VI_COMMAND_MODE 60
+#define VI_COMMENT_OUT 61
+#define VI_DELETE_META 62
+#define VI_DELETE_PREV_CHAR 63
+#define VI_END_BIG_WORD 64
+#define VI_END_WORD 65
+#define VI_HISTEDIT 66
+#define VI_HISTORY_WORD 67
+#define VI_INSERT 68
+#define VI_INSERT_AT_BOL 69
+#define VI_KILL_LINE_PREV 70
+#define VI_LIST_OR_EOF 71
+#define VI_MATCH 72
+#define VI_NEXT_BIG_WORD 73
+#define VI_NEXT_CHAR 74
+#define VI_NEXT_WORD 75
+#define VI_PASTE_NEXT 76
+#define VI_PASTE_PREV 77
+#define VI_PREV_BIG_WORD 78
+#define VI_PREV_CHAR 79
+#define VI_PREV_WORD 80
+#define VI_REDO 81
+#define VI_REPEAT_NEXT_CHAR 82
+#define VI_REPEAT_PREV_CHAR 83
+#define VI_REPEAT_SEARCH_NEXT 84
+#define VI_REPEAT_SEARCH_PREV 85
+#define VI_REPLACE_CHAR 86
+#define VI_REPLACE_MODE 87
+#define VI_SEARCH_NEXT 88
+#define VI_SEARCH_PREV 89
+#define VI_SUBSTITUTE_CHAR 90
+#define VI_SUBSTITUTE_LINE 91
+#define VI_TO_COLUMN 92
+#define VI_TO_HISTORY_LINE 93
+#define VI_TO_NEXT_CHAR 94
+#define VI_TO_PREV_CHAR 95
+#define VI_UNDO 96
+#define VI_UNDO_LINE 97
+#define VI_YANK 98
+#define VI_YANK_END 99
+#define VI_ZERO 100
+#define EL_NUM_FCNS 101
+typedef el_action_t (*el_func_t)(EditLine *, int);
+protected const el_func_t* func__get(void);
+#endif /* _h_fcns_c */
diff --git a/frontend/libedit/filecomplete.c b/frontend/libedit/filecomplete.c
new file mode 100644
index 0000000..dd450ca
--- /dev/null
+++ b/frontend/libedit/filecomplete.c
@@ -0,0 +1,550 @@
+/* $NetBSD: filecomplete.c,v 1.9 2006/08/21 12:45:30 christos Exp $ */
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jaromir Dolecek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* AIX requires this to be the first thing in the file. */
+#if defined (_AIX) && !defined (__GNUC__)
+ #pragma alloca
+#endif
+
+#include <config.h>
+
+#ifdef __GNUC__
+# undef alloca
+# define alloca(n) __builtin_alloca (n)
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifndef _AIX
+extern char *alloca ();
+# endif
+# endif
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <string.h>
+#include <pwd.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <vis.h>
+
+#include "sys.h"
+#include "el.h"
+#include "fcns.h" /* for EL_NUM_FCNS */
+#include "histedit.h"
+#include "filecomplete.h"
+
+static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$',
+ '>', '<', '=', ';', '|', '&', '{', '(', '\0' };
+
+
+/********************************/
+/* completion functions */
+
+/*
+ * does tilde expansion of strings of type ``~user/foo''
+ * if ``user'' isn't valid user name or ``txt'' doesn't start
+ * w/ '~', returns pointer to strdup()ed copy of ``txt''
+ *
+ * it's callers's responsibility to free() returned string
+ */
+char *
+fn_tilde_expand(const char *txt)
+{
+ struct passwd pwres, *pass;
+ char *temp;
+ size_t len = 0;
+ char pwbuf[1024];
+
+ if (txt[0] != '~')
+ return (strdup(txt));
+
+ temp = strchr(txt + 1, '/');
+ if (temp == NULL) {
+ temp = strdup(txt + 1);
+ if (temp == NULL)
+ return NULL;
+ } else {
+ len = temp - txt + 1; /* text until string after slash */
+ temp = malloc(len);
+ if (temp == NULL)
+ return NULL;
+ (void)strncpy(temp, txt + 1, len - 2);
+ temp[len - 2] = '\0';
+ }
+ if (temp[0] == 0) {
+#ifdef HAVE_GETPW_R_POSIX
+ if (getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf), &pass) != 0)
+ pass = NULL;
+#elif HAVE_GETPW_R_DRAFT
+ pass = getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf));
+#else
+ pass = getpwuid(getuid());
+#endif
+ } else {
+#ifdef HAVE_GETPW_R_POSIX
+ if (getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf), &pass) != 0)
+ pass = NULL;
+#elif HAVE_GETPW_R_DRAFT
+ pass = getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf));
+#else
+ pass = getpwnam(temp);
+#endif
+ }
+ free(temp); /* value no more needed */
+ if (pass == NULL)
+ return (strdup(txt));
+
+ /* update pointer txt to point at string immedially following */
+ /* first slash */
+ txt += len;
+
+ temp = malloc(strlen(pass->pw_dir) + 1 + strlen(txt) + 1);
+ if (temp == NULL)
+ return NULL;
+ (void)sprintf(temp, "%s/%s", pass->pw_dir, txt);
+
+ return (temp);
+}
+
+
+/*
+ * return first found file name starting by the ``text'' or NULL if no
+ * such file can be found
+ * value of ``state'' is ignored
+ *
+ * it's caller's responsibility to free returned string
+ */
+char *
+fn_filename_completion_function(const char *text, int state)
+{
+ static DIR *dir = NULL;
+ static char *filename = NULL, *dirname = NULL, *dirpath = NULL;
+ static size_t filename_len = 0;
+ struct dirent *entry;
+ char *temp;
+ size_t len;
+
+ if (state == 0 || dir == NULL) {
+ temp = strrchr(text, '/');
+ if (temp) {
+ char *nptr;
+ temp++;
+ nptr = realloc(filename, strlen(temp) + 1);
+ if (nptr == NULL) {
+ free(filename);
+ return NULL;
+ }
+ filename = nptr;
+ (void)strcpy(filename, temp);
+ len = temp - text; /* including last slash */
+ nptr = realloc(dirname, len + 1);
+ if (nptr == NULL) {
+ free(filename);
+ return NULL;
+ }
+ dirname = nptr;
+ (void)strncpy(dirname, text, len);
+ dirname[len] = '\0';
+ } else {
+ if (*text == 0)
+ filename = NULL;
+ else {
+ filename = strdup(text);
+ if (filename == NULL)
+ return NULL;
+ }
+ dirname = NULL;
+ }
+
+ if (dir != NULL) {
+ (void)closedir(dir);
+ dir = NULL;
+ }
+
+ /* support for ``~user'' syntax */
+ free(dirpath);
+
+ if (dirname == NULL && (dirname = strdup("./")) == NULL)
+ return NULL;
+
+ if (*dirname == '~')
+ dirpath = fn_tilde_expand(dirname);
+ else
+ dirpath = strdup(dirname);
+
+ if (dirpath == NULL)
+ return NULL;
+
+ dir = opendir(dirpath);
+ if (!dir)
+ return (NULL); /* cannot open the directory */
+
+ /* will be used in cycle */
+ filename_len = filename ? strlen(filename) : 0;
+ }
+
+ /* find the match */
+ while ((entry = readdir(dir)) != NULL) {
+ /* skip . and .. */
+ if (entry->d_name[0] == '.' && (!entry->d_name[1]
+ || (entry->d_name[1] == '.' && !entry->d_name[2])))
+ continue;
+ if (filename_len == 0)
+ break;
+ /* otherwise, get first entry where first */
+ /* filename_len characters are equal */
+ if (entry->d_name[0] == filename[0]
+ /* Some dirents have d_namlen, but it is not portable. */
+ && strlen(entry->d_name) >= filename_len
+ && strncmp(entry->d_name, filename,
+ filename_len) == 0)
+ break;
+ }
+
+ if (entry) { /* match found */
+
+ /* Some dirents have d_namlen, but it is not portable. */
+ len = strlen(entry->d_name);
+ temp = malloc(strlen(dirname) + len + 1);
+ if (temp == NULL)
+ return NULL;
+ (void)sprintf(temp, "%s%s", dirname, entry->d_name);
+ } else {
+ (void)closedir(dir);
+ dir = NULL;
+ temp = NULL;
+ }
+
+ return (temp);
+}
+
+
+static const char *
+append_char_function(const char *name)
+{
+ struct stat stbuf;
+ char *expname = *name == '~' ? fn_tilde_expand(name) : NULL;
+ const char *rs = "";
+
+ if (stat(expname ? expname : name, &stbuf) == -1)
+ goto out;
+ if (S_ISDIR(stbuf.st_mode))
+ rs = "/";
+out:
+ if (expname)
+ free(expname);
+ return rs;
+}
+/*
+ * returns list of completions for text given
+ * non-static for readline.
+ */
+char ** completion_matches(const char *, char *(*)(const char *, int));
+char **
+completion_matches(const char *text, char *(*genfunc)(const char *, int))
+{
+ char **match_list = NULL, *retstr, *prevstr;
+ size_t match_list_len, max_equal, which, i;
+ size_t matches;
+
+ matches = 0;
+ match_list_len = 1;
+ while ((retstr = (*genfunc) (text, (int)matches)) != NULL) {
+ /* allow for list terminator here */
+ if (matches + 3 >= match_list_len) {
+ char **nmatch_list;
+ while (matches + 3 >= match_list_len)
+ match_list_len <<= 1;
+ nmatch_list = realloc(match_list,
+ match_list_len * sizeof(char *));
+ if (nmatch_list == NULL) {
+ free(match_list);
+ return NULL;
+ }
+ match_list = nmatch_list;
+
+ }
+ match_list[++matches] = retstr;
+ }
+
+ if (!match_list)
+ return NULL; /* nothing found */
+
+ /* find least denominator and insert it to match_list[0] */
+ which = 2;
+ prevstr = match_list[1];
+ max_equal = strlen(prevstr);
+ for (; which <= matches; which++) {
+ for (i = 0; i < max_equal &&
+ prevstr[i] == match_list[which][i]; i++)
+ continue;
+ max_equal = i;
+ }
+
+ retstr = malloc(max_equal + 1);
+ if (retstr == NULL) {
+ free(match_list);
+ return NULL;
+ }
+ (void)strncpy(retstr, match_list[1], max_equal);
+ retstr[max_equal] = '\0';
+ match_list[0] = retstr;
+
+ /* add NULL as last pointer to the array */
+ match_list[matches + 1] = (char *) NULL;
+
+ return (match_list);
+}
+
+/*
+ * Sort function for qsort(). Just wrapper around strcasecmp().
+ */
+static int
+_fn_qsort_string_compare(const void *i1, const void *i2)
+{
+ const char *s1 = ((const char * const *)i1)[0];
+ const char *s2 = ((const char * const *)i2)[0];
+
+ return strcasecmp(s1, s2);
+}
+
+/*
+ * Display list of strings in columnar format on readline's output stream.
+ * 'matches' is list of strings, 'len' is number of strings in 'matches',
+ * 'max' is maximum length of string in 'matches'.
+ */
+void
+fn_display_match_list (EditLine *el, char **matches, int len, int max)
+{
+ int i, idx, limit, count;
+ int screenwidth = el->el_term.t_size.h;
+
+ /*
+ * Find out how many entries can be put on one line, count
+ * with two spaces between strings.
+ */
+ limit = screenwidth / (max + 2);
+ if (limit == 0)
+ limit = 1;
+
+ /* how many lines of output */
+ count = len / limit;
+ if (count * limit < len)
+ count++;
+
+ /* Sort the items if they are not already sorted. */
+ qsort(&matches[1], (size_t)(len - 1), sizeof(char *),
+ _fn_qsort_string_compare);
+
+ idx = 1;
+ for(; count > 0; count--) {
+ for(i = 0; i < limit && matches[idx]; i++, idx++)
+ (void)fprintf(el->el_outfile, "%-*s ", max,
+ matches[idx]);
+ (void)fprintf(el->el_outfile, "\n");
+ }
+}
+
+/*
+ * Complete the word at or before point,
+ * 'what_to_do' says what to do with the completion.
+ * \t means do standard completion.
+ * `?' means list the possible completions.
+ * `*' means insert all of the possible completions.
+ * `!' means to do standard completion, and list all possible completions if
+ * there is more than one.
+ *
+ * Note: '*' support is not implemented
+ * '!' could never be invoked
+ */
+int
+fn_complete(EditLine *el,
+ char *(*complet_func)(const char *, int),
+ char **(*attempted_completion_function)(const char *, int, int),
+ const char *word_break, const char *special_prefixes,
+ const char *(*app_func)(const char *), int query_items,
+ int *completion_type, int *over, int *point, int *end)
+{
+ const LineInfo *li;
+ char *temp, **matches;
+ const char *ctemp;
+ size_t len;
+ int what_to_do = '\t';
+
+ if (el->el_state.lastcmd == el->el_state.thiscmd)
+ what_to_do = '?';
+
+ /* readline's rl_complete() has to be told what we did... */
+ if (completion_type != NULL)
+ *completion_type = what_to_do;
+
+ if (!complet_func)
+ complet_func = fn_filename_completion_function;
+ if (!app_func)
+ app_func = append_char_function;
+
+ /* We now look backwards for the start of a filename/variable word */
+ li = el_line(el);
+ ctemp = (const char *) li->cursor;
+ while (ctemp > li->buffer
+ && !strchr(word_break, ctemp[-1])
+ && (!special_prefixes || !strchr(special_prefixes, ctemp[-1]) ) )
+ ctemp--;
+
+ len = li->cursor - ctemp;
+ temp = alloca(len + 1);
+ (void)strncpy(temp, ctemp, len);
+ temp[len] = '\0';
+
+ /* these can be used by function called in completion_matches() */
+ /* or (*attempted_completion_function)() */
+ if (point != 0)
+ *point = li->cursor - li->buffer;
+ if (end != NULL)
+ *end = li->lastchar - li->buffer;
+
+ if (attempted_completion_function) {
+ int cur_off = li->cursor - li->buffer;
+ matches = (*attempted_completion_function) (temp,
+ (int)(cur_off - len), cur_off);
+ } else
+ matches = 0;
+ if (!attempted_completion_function ||
+ (over != NULL && !*over && !matches))
+ matches = completion_matches(temp, complet_func);
+
+ if (over != NULL)
+ *over = 0;
+
+ if (matches) {
+ int i, retval = CC_REFRESH;
+ int matches_num, maxlen, match_len, match_display=1;
+
+ /*
+ * Only replace the completed string with common part of
+ * possible matches if there is possible completion.
+ */
+ if (matches[0][0] != '\0') {
+ el_deletestr(el, (int) len);
+ el_insertstr(el, matches[0]);
+ }
+
+ if (what_to_do == '?')
+ goto display_matches;
+
+ if (matches[2] == NULL && strcmp(matches[0], matches[1]) == 0) {
+ /*
+ * We found exact match. Add a space after
+ * it, unless we do filename completion and the
+ * object is a directory.
+ */
+ el_insertstr(el, (*append_char_function)(matches[0]));
+ } else if (what_to_do == '!') {
+ display_matches:
+ /*
+ * More than one match and requested to list possible
+ * matches.
+ */
+
+ for(i=1, maxlen=0; matches[i]; i++) {
+ match_len = strlen(matches[i]);
+ if (match_len > maxlen)
+ maxlen = match_len;
+ }
+ matches_num = i - 1;
+
+ /* newline to get on next line from command line */
+ (void)fprintf(el->el_outfile, "\n");
+
+ /*
+ * If there are too many items, ask user for display
+ * confirmation.
+ */
+ if (matches_num > query_items) {
+ (void)fprintf(el->el_outfile,
+ "Display all %d possibilities? (y or n) ",
+ matches_num);
+ (void)fflush(el->el_outfile);
+ if (getc(stdin) != 'y')
+ match_display = 0;
+ (void)fprintf(el->el_outfile, "\n");
+ }
+
+ if (match_display)
+ fn_display_match_list(el, matches, matches_num,
+ maxlen);
+ retval = CC_REDISPLAY;
+ } else if (matches[0][0]) {
+ /*
+ * There was some common match, but the name was
+ * not complete enough. Next tab will print possible
+ * completions.
+ */
+ el_beep(el);
+ } else {
+ /* lcd is not a valid object - further specification */
+ /* is needed */
+ el_beep(el);
+ retval = CC_NORM;
+ }
+
+ /* free elements of array and the array itself */
+ for (i = 0; matches[i]; i++)
+ free(matches[i]);
+ free(matches), matches = NULL;
+
+ return (retval);
+ }
+ return (CC_NORM);
+}
+
+/*
+ * el-compatible wrapper around rl_complete; needed for key binding
+ */
+/* ARGSUSED */
+unsigned char
+_el_fn_complete(EditLine *el, int ch __attribute__((__unused__)))
+{
+ return (unsigned char)fn_complete(el, NULL, NULL,
+ break_chars, NULL, NULL, 100,
+ NULL, NULL, NULL, NULL);
+}
diff --git a/frontend/libedit/filecomplete.h b/frontend/libedit/filecomplete.h
new file mode 100644
index 0000000..f725378
--- /dev/null
+++ b/frontend/libedit/filecomplete.h
@@ -0,0 +1,47 @@
+/* $NetBSD: filecomplete.h,v 1.5 2006/08/21 12:45:30 christos Exp $ */
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jaromir Dolecek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _FILECOMPLETE_H_
+#define _FILECOMPLETE_H_
+
+int fn_complete(EditLine *,
+ char *(*)(const char *, int),
+ char **(*)(const char *, int, int),
+ const char *, const char *, const char *(*)(const char *), int,
+ int *, int *, int *, int *);
+
+void fn_display_match_list(EditLine *, char **, int, int);
+char *fn_tilde_expand(const char *);
+char *fn_filename_completion_function(const char *, int);
+
+#endif
diff --git a/frontend/libedit/help.c b/frontend/libedit/help.c
new file mode 100644
index 0000000..7cbb5f6
--- /dev/null
+++ b/frontend/libedit/help.c
@@ -0,0 +1,210 @@
+/* Automatically generated file, do not edit */
+#include "sys.h"
+#include "el.h"
+private const struct el_bindings_t el_func_help[] = {
+ { "vi-paste-next", VI_PASTE_NEXT,
+ "Vi paste previous deletion to the right of the cursor" },
+ { "vi-paste-prev", VI_PASTE_PREV,
+ "Vi paste previous deletion to the left of the cursor" },
+ { "vi-prev-big-word", VI_PREV_BIG_WORD,
+ "Vi move to the previous space delimited word" },
+ { "vi-prev-word", VI_PREV_WORD,
+ "Vi move to the previous word" },
+ { "vi-next-big-word", VI_NEXT_BIG_WORD,
+ "Vi move to the next space delimited word" },
+ { "vi-next-word", VI_NEXT_WORD,
+ "Vi move to the next word" },
+ { "vi-change-case", VI_CHANGE_CASE,
+ "Vi change case of character under the cursor and advance one character" },
+ { "vi-change-meta", VI_CHANGE_META,
+ "Vi change prefix command" },
+ { "vi-insert-at-bol", VI_INSERT_AT_BOL,
+ "Vi enter insert mode at the beginning of line" },
+ { "vi-replace-char", VI_REPLACE_CHAR,
+ "Vi replace character under the cursor with the next character typed" },
+ { "vi-replace-mode", VI_REPLACE_MODE,
+ "Vi enter replace mode" },
+ { "vi-substitute-char", VI_SUBSTITUTE_CHAR,
+ "Vi replace character under the cursor and enter insert mode" },
+ { "vi-substitute-line", VI_SUBSTITUTE_LINE,
+ "Vi substitute entire line" },
+ { "vi-change-to-eol", VI_CHANGE_TO_EOL,
+ "Vi change to end of line" },
+ { "vi-insert", VI_INSERT,
+ "Vi enter insert mode" },
+ { "vi-add", VI_ADD,
+ "Vi enter insert mode after the cursor" },
+ { "vi-add-at-eol", VI_ADD_AT_EOL,
+ "Vi enter insert mode at end of line" },
+ { "vi-delete-meta", VI_DELETE_META,
+ "Vi delete prefix command" },
+ { "vi-end-big-word", VI_END_BIG_WORD,
+ "Vi move to the end of the current space delimited word" },
+ { "vi-end-word", VI_END_WORD,
+ "Vi move to the end of the current word" },
+ { "vi-undo", VI_UNDO,
+ "Vi undo last change" },
+ { "vi-command-mode", VI_COMMAND_MODE,
+ "Vi enter command mode (use alternative key bindings)" },
+ { "vi-zero", VI_ZERO,
+ "Vi move to the beginning of line" },
+ { "vi-delete-prev-char", VI_DELETE_PREV_CHAR,
+ "Vi move to previous character (backspace)" },
+ { "vi-list-or-eof", VI_LIST_OR_EOF,
+ "Vi list choices for completion or indicate end of file if empty line" },
+ { "vi-kill-line-prev", VI_KILL_LINE_PREV,
+ "Vi cut from beginning of line to cursor" },
+ { "vi-search-prev", VI_SEARCH_PREV,
+ "Vi search history previous" },
+ { "vi-search-next", VI_SEARCH_NEXT,
+ "Vi search history next" },
+ { "vi-repeat-search-next", VI_REPEAT_SEARCH_NEXT,
+ "Vi repeat current search in the same search direction" },
+ { "vi-repeat-search-prev", VI_REPEAT_SEARCH_PREV,
+ "Vi repeat current search in the opposite search direction" },
+ { "vi-next-char", VI_NEXT_CHAR,
+ "Vi move to the character specified next" },
+ { "vi-prev-char", VI_PREV_CHAR,
+ "Vi move to the character specified previous" },
+ { "vi-to-next-char", VI_TO_NEXT_CHAR,
+ "Vi move up to the character specified next" },
+ { "vi-to-prev-char", VI_TO_PREV_CHAR,
+ "Vi move up to the character specified previous" },
+ { "vi-repeat-next-char", VI_REPEAT_NEXT_CHAR,
+ "Vi repeat current character search in the same search direction" },
+ { "vi-repeat-prev-char", VI_REPEAT_PREV_CHAR,
+ "Vi repeat current character search in the opposite search direction" },
+ { "vi-match", VI_MATCH,
+ "Vi go to matching () {} or []" },
+ { "vi-undo-line", VI_UNDO_LINE,
+ "Vi undo all changes to line" },
+ { "vi-to-column", VI_TO_COLUMN,
+ "Vi go to specified column" },
+ { "vi-yank-end", VI_YANK_END,
+ "Vi yank to end of line" },
+ { "vi-yank", VI_YANK,
+ "Vi yank" },
+ { "vi-comment-out", VI_COMMENT_OUT,
+ "Vi comment out current command" },
+ { "vi-alias", VI_ALIAS,
+ "Vi include shell alias" },
+ { "vi-to-history-line", VI_TO_HISTORY_LINE,
+ "Vi go to specified history file line." },
+ { "vi-histedit", VI_HISTEDIT,
+ "Vi edit history line with vi" },
+ { "vi-history-word", VI_HISTORY_WORD,
+ "Vi append word from previous input line" },
+ { "vi-redo", VI_REDO,
+ "Vi redo last non-motion command" },
+ { "em-delete-or-list", EM_DELETE_OR_LIST,
+ "Delete character under cursor or list completions if at end of line" },
+ { "em-delete-next-word", EM_DELETE_NEXT_WORD,
+ "Cut from cursor to end of current word" },
+ { "em-yank", EM_YANK,
+ "Paste cut buffer at cursor position" },
+ { "em-kill-line", EM_KILL_LINE,
+ "Cut the entire line and save in cut buffer" },
+ { "em-kill-region", EM_KILL_REGION,
+ "Cut area between mark and cursor and save in cut buffer" },
+ { "em-copy-region", EM_COPY_REGION,
+ "Copy area between mark and cursor to cut buffer" },
+ { "em-gosmacs-transpose", EM_GOSMACS_TRANSPOSE,
+ "Exchange the two characters before the cursor" },
+ { "em-next-word", EM_NEXT_WORD,
+ "Move next to end of current word" },
+ { "em-upper-case", EM_UPPER_CASE,
+ "Uppercase the characters from cursor to end of current word" },
+ { "em-capitol-case", EM_CAPITOL_CASE,
+ "Capitalize the characters from cursor to end of current word" },
+ { "em-lower-case", EM_LOWER_CASE,
+ "Lowercase the characters from cursor to end of current word" },
+ { "em-set-mark", EM_SET_MARK,
+ "Set the mark at cursor" },
+ { "em-exchange-mark", EM_EXCHANGE_MARK,
+ "Exchange the cursor and mark" },
+ { "em-universal-argument", EM_UNIVERSAL_ARGUMENT,
+ "Universal argument (argument times 4)" },
+ { "em-meta-next", EM_META_NEXT,
+ "Add 8th bit to next character typed" },
+ { "em-toggle-overwrite", EM_TOGGLE_OVERWRITE,
+ "Switch from insert to overwrite mode or vice versa" },
+ { "em-copy-prev-word", EM_COPY_PREV_WORD,
+ "Copy current word to cursor" },
+ { "em-inc-search-next", EM_INC_SEARCH_NEXT,
+ "Emacs incremental next search" },
+ { "em-inc-search-prev", EM_INC_SEARCH_PREV,
+ "Emacs incremental reverse search" },
+ { "ed-end-of-file", ED_END_OF_FILE,
+ "Indicate end of file" },
+ { "ed-insert", ED_INSERT,
+ "Add character to the line" },
+ { "ed-delete-prev-word", ED_DELETE_PREV_WORD,
+ "Delete from beginning of current word to cursor" },
+ { "ed-delete-next-char", ED_DELETE_NEXT_CHAR,
+ "Delete character under cursor" },
+ { "ed-kill-line", ED_KILL_LINE,
+ "Cut to the end of line" },
+ { "ed-move-to-end", ED_MOVE_TO_END,
+ "Move cursor to the end of line" },
+ { "ed-move-to-beg", ED_MOVE_TO_BEG,
+ "Move cursor to the beginning of line" },
+ { "ed-transpose-chars", ED_TRANSPOSE_CHARS,
+ "Exchange the character to the left of the cursor with the one under it" },
+ { "ed-next-char", ED_NEXT_CHAR,
+ "Move to the right one character" },
+ { "ed-prev-word", ED_PREV_WORD,
+ "Move to the beginning of the current word" },
+ { "ed-prev-char", ED_PREV_CHAR,
+ "Move to the left one character" },
+ { "ed-quoted-insert", ED_QUOTED_INSERT,
+ "Add the next character typed verbatim" },
+ { "ed-digit", ED_DIGIT,
+ "Adds to argument or enters a digit" },
+ { "ed-argument-digit", ED_ARGUMENT_DIGIT,
+ "Digit that starts argument" },
+ { "ed-unassigned", ED_UNASSIGNED,
+ "Indicates unbound character" },
+ { "ed-tty-sigint", ED_TTY_SIGINT,
+ "Tty interrupt character" },
+ { "ed-tty-dsusp", ED_TTY_DSUSP,
+ "Tty delayed suspend character" },
+ { "ed-tty-flush-output", ED_TTY_FLUSH_OUTPUT,
+ "Tty flush output characters" },
+ { "ed-tty-sigquit", ED_TTY_SIGQUIT,
+ "Tty quit character" },
+ { "ed-tty-sigtstp", ED_TTY_SIGTSTP,
+ "Tty suspend character" },
+ { "ed-tty-stop-output", ED_TTY_STOP_OUTPUT,
+ "Tty disallow output characters" },
+ { "ed-tty-start-output", ED_TTY_START_OUTPUT,
+ "Tty allow output characters" },
+ { "ed-newline", ED_NEWLINE,
+ "Execute command" },
+ { "ed-delete-prev-char", ED_DELETE_PREV_CHAR,
+ "Delete the character to the left of the cursor" },
+ { "ed-clear-screen", ED_CLEAR_SCREEN,
+ "Clear screen leaving current line at the top" },
+ { "ed-redisplay", ED_REDISPLAY,
+ "Redisplay everything" },
+ { "ed-start-over", ED_START_OVER,
+ "Erase current line and start from scratch" },
+ { "ed-sequence-lead-in", ED_SEQUENCE_LEAD_IN,
+ "First character in a bound sequence" },
+ { "ed-prev-history", ED_PREV_HISTORY,
+ "Move to the previous history line" },
+ { "ed-next-history", ED_NEXT_HISTORY,
+ "Move to the next history line" },
+ { "ed-search-prev-history", ED_SEARCH_PREV_HISTORY,
+ "Search previous in history for a line matching the current" },
+ { "ed-search-next-history", ED_SEARCH_NEXT_HISTORY,
+ "Search next in history for a line matching the current" },
+ { "ed-prev-line", ED_PREV_LINE,
+ "Move up one line" },
+ { "ed-next-line", ED_NEXT_LINE,
+ "Move down one line" },
+ { "ed-command", ED_COMMAND,
+ "Editline extended command" },
+ { NULL, 0, NULL }
+};
+
+protected const el_bindings_t* help__get(){ return el_func_help; }
diff --git a/frontend/libedit/help.h b/frontend/libedit/help.h
new file mode 100644
index 0000000..a7e89a1
--- /dev/null
+++ b/frontend/libedit/help.h
@@ -0,0 +1,5 @@
+/* Automatically generated file, do not edit */
+#ifndef _h_help_c
+#define _h_help_c
+protected const el_bindings_t *help__get(void);
+#endif /* _h_help_c */
diff --git a/frontend/libedit/hist.c b/frontend/libedit/hist.c
new file mode 100644
index 0000000..4db3ef2
--- /dev/null
+++ b/frontend/libedit/hist.c
@@ -0,0 +1,204 @@
+/* $NetBSD: hist.c,v 1.15 2003/11/01 23:36:39 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * hist.c: History access functions
+ */
+#include <stdlib.h>
+#include "el.h"
+
+/* hist_init():
+ * Initialization function.
+ */
+protected int
+hist_init(EditLine *el)
+{
+
+ el->el_history.fun = NULL;
+ el->el_history.ref = NULL;
+ el->el_history.buf = (char *) el_malloc(EL_BUFSIZ);
+ el->el_history.sz = EL_BUFSIZ;
+ if (el->el_history.buf == NULL)
+ return (-1);
+ el->el_history.last = el->el_history.buf;
+ return (0);
+}
+
+
+/* hist_end():
+ * clean up history;
+ */
+protected void
+hist_end(EditLine *el)
+{
+
+ el_free((ptr_t) el->el_history.buf);
+ el->el_history.buf = NULL;
+}
+
+
+/* hist_set():
+ * Set new history interface
+ */
+protected int
+hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr)
+{
+
+ el->el_history.ref = ptr;
+ el->el_history.fun = fun;
+ return (0);
+}
+
+
+/* hist_get():
+ * Get a history line and update it in the buffer.
+ * eventno tells us the event to get.
+ */
+protected el_action_t
+hist_get(EditLine *el)
+{
+ const char *hp;
+ int h;
+
+ if (el->el_history.eventno == 0) { /* if really the current line */
+ (void) strncpy(el->el_line.buffer, el->el_history.buf,
+ el->el_history.sz);
+ el->el_line.lastchar = el->el_line.buffer +
+ (el->el_history.last - el->el_history.buf);
+
+#ifdef KSHVI
+ if (el->el_map.type == MAP_VI)
+ el->el_line.cursor = el->el_line.buffer;
+ else
+#endif /* KSHVI */
+ el->el_line.cursor = el->el_line.lastchar;
+
+ return (CC_REFRESH);
+ }
+ if (el->el_history.ref == NULL)
+ return (CC_ERROR);
+
+ hp = HIST_FIRST(el);
+
+ if (hp == NULL)
+ return (CC_ERROR);
+
+ for (h = 1; h < el->el_history.eventno; h++)
+ if ((hp = HIST_NEXT(el)) == NULL) {
+ el->el_history.eventno = h;
+ return (CC_ERROR);
+ }
+ (void) strlcpy(el->el_line.buffer, hp,
+ (size_t)(el->el_line.limit - el->el_line.buffer));
+ el->el_line.lastchar = el->el_line.buffer + strlen(el->el_line.buffer);
+
+ if (el->el_line.lastchar > el->el_line.buffer
+ && el->el_line.lastchar[-1] == '\n')
+ el->el_line.lastchar--;
+ if (el->el_line.lastchar > el->el_line.buffer
+ && el->el_line.lastchar[-1] == ' ')
+ el->el_line.lastchar--;
+#ifdef KSHVI
+ if (el->el_map.type == MAP_VI)
+ el->el_line.cursor = el->el_line.buffer;
+ else
+#endif /* KSHVI */
+ el->el_line.cursor = el->el_line.lastchar;
+
+ return (CC_REFRESH);
+}
+
+
+/* hist_command()
+ * process a history command
+ */
+protected int
+hist_command(EditLine *el, int argc, const char **argv)
+{
+ const char *str;
+ int num;
+ HistEvent ev;
+
+ if (el->el_history.ref == NULL)
+ return (-1);
+
+ if (argc == 1 || strcmp(argv[1], "list") == 0) {
+ /* List history entries */
+
+ for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el))
+ (void) fprintf(el->el_outfile, "%d %s",
+ el->el_history.ev.num, str);
+ return (0);
+ }
+
+ if (argc != 3)
+ return (-1);
+
+ num = (int)strtol(argv[2], NULL, 0);
+
+ if (strcmp(argv[1], "size") == 0)
+ return history(el->el_history.ref, &ev, H_SETSIZE, num);
+
+ if (strcmp(argv[1], "unique") == 0)
+ return history(el->el_history.ref, &ev, H_SETUNIQUE, num);
+
+ return -1;
+}
+
+/* hist_enlargebuf()
+ * Enlarge history buffer to specified value. Called from el_enlargebufs().
+ * Return 0 for failure, 1 for success.
+ */
+protected int
+/*ARGSUSED*/
+hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz)
+{
+ char *newbuf;
+
+ newbuf = realloc(el->el_history.buf, newsz);
+ if (!newbuf)
+ return 0;
+
+ (void) memset(&newbuf[oldsz], '\0', newsz - oldsz);
+
+ el->el_history.last = newbuf +
+ (el->el_history.last - el->el_history.buf);
+ el->el_history.buf = newbuf;
+ el->el_history.sz = newsz;
+
+ return 1;
+}
diff --git a/frontend/libedit/hist.h b/frontend/libedit/hist.h
new file mode 100644
index 0000000..46e1463
--- /dev/null
+++ b/frontend/libedit/hist.h
@@ -0,0 +1,76 @@
+/* $NetBSD: hist.h,v 1.10 2003/08/07 16:44:31 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)hist.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.hist.c: History functions
+ */
+#ifndef _h_el_hist
+#define _h_el_hist
+
+#include "histedit.h"
+
+typedef int (*hist_fun_t)(ptr_t, HistEvent *, int, ...);
+
+typedef struct el_history_t {
+ char *buf; /* The history buffer */
+ size_t sz; /* Size of history buffer */
+ char *last; /* The last character */
+ int eventno; /* Event we are looking for */
+ ptr_t ref; /* Argument for history fcns */
+ hist_fun_t fun; /* Event access */
+ HistEvent ev; /* Event cookie */
+} el_history_t;
+
+#define HIST_FUN(el, fn, arg) \
+ ((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \
+ fn, arg)) == -1) ? NULL : (el)->el_history.ev.str)
+
+#define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL)
+#define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL)
+#define HIST_LAST(el) HIST_FUN(el, H_LAST, NULL)
+#define HIST_PREV(el) HIST_FUN(el, H_PREV, NULL)
+#define HIST_SET(el, num) HIST_FUN(el, H_SET, num)
+#define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname)
+#define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname)
+
+protected int hist_init(EditLine *);
+protected void hist_end(EditLine *);
+protected el_action_t hist_get(EditLine *);
+protected int hist_set(EditLine *, hist_fun_t, ptr_t);
+protected int hist_command(EditLine *, int, const char **);
+protected int hist_enlargebuf(EditLine *, size_t, size_t);
+
+#endif /* _h_el_hist */
diff --git a/frontend/libedit/histedit.h b/frontend/libedit/histedit.h
new file mode 100644
index 0000000..40f0dd1
--- /dev/null
+++ b/frontend/libedit/histedit.h
@@ -0,0 +1,224 @@
+/* $NetBSD: histedit.h,v 1.28 2005/07/14 15:00:58 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)histedit.h 8.2 (Berkeley) 1/3/94
+ */
+
+/*
+ * histedit.h: Line editor and history interface.
+ */
+#ifndef _HISTEDIT_H_
+#define _HISTEDIT_H_
+
+#define LIBEDIT_MAJOR 2
+#define LIBEDIT_MINOR 9
+
+#include <sys/types.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * ==== Editing ====
+ */
+
+typedef struct editline EditLine;
+
+/*
+ * For user-defined function interface
+ */
+typedef struct lineinfo {
+ const char *buffer;
+ const char *cursor;
+ const char *lastchar;
+} LineInfo;
+
+/*
+ * EditLine editor function return codes.
+ * For user-defined function interface
+ */
+#define CC_NORM 0
+#define CC_NEWLINE 1
+#define CC_EOF 2
+#define CC_ARGHACK 3
+#define CC_REFRESH 4
+#define CC_CURSOR 5
+#define CC_ERROR 6
+#define CC_FATAL 7
+#define CC_REDISPLAY 8
+#define CC_REFRESH_BEEP 9
+
+/*
+ * Initialization, cleanup, and resetting
+ */
+EditLine *el_init(const char *, FILE *, FILE *, FILE *);
+void el_end(EditLine *);
+void el_reset(EditLine *);
+
+/*
+ * Get a line, a character or push a string back in the input queue
+ */
+const char *el_gets(EditLine *, int *);
+int el_getc(EditLine *, char *);
+void el_push(EditLine *, char *);
+
+/*
+ * Beep!
+ */
+void el_beep(EditLine *);
+
+/*
+ * High level function internals control
+ * Parses argc, argv array and executes builtin editline commands
+ */
+int el_parse(EditLine *, int, const char **);
+
+/*
+ * Low level editline access functions
+ */
+int el_set(EditLine *, int, ...);
+int el_get(EditLine *, int, void *);
+unsigned char _el_fn_complete(EditLine *, int);
+
+/*
+ * el_set/el_get parameters
+ */
+#define EL_PROMPT 0 /* , el_pfunc_t); */
+#define EL_TERMINAL 1 /* , const char *); */
+#define EL_EDITOR 2 /* , const char *); */
+#define EL_SIGNAL 3 /* , int); */
+#define EL_BIND 4 /* , const char *, ..., NULL); */
+#define EL_TELLTC 5 /* , const char *, ..., NULL); */
+#define EL_SETTC 6 /* , const char *, ..., NULL); */
+#define EL_ECHOTC 7 /* , const char *, ..., NULL); */
+#define EL_SETTY 8 /* , const char *, ..., NULL); */
+#define EL_ADDFN 9 /* , const char *, const char * */
+ /* , el_func_t); */
+#define EL_HIST 10 /* , hist_fun_t, const char *); */
+#define EL_EDITMODE 11 /* , int); */
+#define EL_RPROMPT 12 /* , el_pfunc_t); */
+#define EL_GETCFN 13 /* , el_rfunc_t); */
+#define EL_CLIENTDATA 14 /* , void *); */
+#define EL_UNBUFFERED 15 /* , int); */
+#define EL_PREP_TERM 16 /* , int); */
+
+#define EL_BUILTIN_GETCFN (NULL)
+
+/*
+ * Source named file or $PWD/.editrc or $HOME/.editrc
+ */
+int el_source(EditLine *, const char *);
+
+/*
+ * Must be called when the terminal changes size; If EL_SIGNAL
+ * is set this is done automatically otherwise it is the responsibility
+ * of the application
+ */
+void el_resize(EditLine *);
+
+/*
+ * User-defined function interface.
+ */
+const LineInfo *el_line(EditLine *);
+int el_insertstr(EditLine *, const char *);
+void el_deletestr(EditLine *, int);
+
+
+/*
+ * ==== History ====
+ */
+
+typedef struct history History;
+
+typedef struct HistEvent {
+ int num;
+ const char *str;
+} HistEvent;
+
+/*
+ * History access functions.
+ */
+History * history_init(void);
+void history_end(History *);
+
+int history(History *, HistEvent *, int, ...);
+
+#define H_FUNC 0 /* , UTSL */
+#define H_SETSIZE 1 /* , const int); */
+#define H_GETSIZE 2 /* , void); */
+#define H_FIRST 3 /* , void); */
+#define H_LAST 4 /* , void); */
+#define H_PREV 5 /* , void); */
+#define H_NEXT 6 /* , void); */
+#define H_CURR 8 /* , const int); */
+#define H_SET 7 /* , int); */
+#define H_ADD 9 /* , const char *); */
+#define H_ENTER 10 /* , const char *); */
+#define H_APPEND 11 /* , const char *); */
+#define H_END 12 /* , void); */
+#define H_NEXT_STR 13 /* , const char *); */
+#define H_PREV_STR 14 /* , const char *); */
+#define H_NEXT_EVENT 15 /* , const int); */
+#define H_PREV_EVENT 16 /* , const int); */
+#define H_LOAD 17 /* , const char *); */
+#define H_SAVE 18 /* , const char *); */
+#define H_CLEAR 19 /* , void); */
+#define H_SETUNIQUE 20 /* , int); */
+#define H_GETUNIQUE 21 /* , void); */
+#define H_DEL 22 /* , int); */
+
+
+/*
+ * ==== Tokenization ====
+ */
+
+typedef struct tokenizer Tokenizer;
+
+/*
+ * String tokenization functions, using simplified sh(1) quoting rules
+ */
+Tokenizer *tok_init(const char *);
+void tok_end(Tokenizer *);
+void tok_reset(Tokenizer *);
+int tok_line(Tokenizer *, const LineInfo *,
+ int *, const char ***, int *, int *);
+int tok_str(Tokenizer *, const char *,
+ int *, const char ***);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HISTEDIT_H_ */
diff --git a/frontend/libedit/history.c b/frontend/libedit/history.c
new file mode 100644
index 0000000..391a90e
--- /dev/null
+++ b/frontend/libedit/history.c
@@ -0,0 +1,981 @@
+/* $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * hist.c: History access functions
+ */
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <vis.h>
+#include <sys/stat.h>
+
+static const char hist_cookie[] = "_HiStOrY_V2_\n";
+
+#include "histedit.h"
+
+typedef int (*history_gfun_t)(ptr_t, HistEvent *);
+typedef int (*history_efun_t)(ptr_t, HistEvent *, const char *);
+typedef void (*history_vfun_t)(ptr_t, HistEvent *);
+typedef int (*history_sfun_t)(ptr_t, HistEvent *, const int);
+
+struct history {
+ ptr_t h_ref; /* Argument for history fcns */
+ int h_ent; /* Last entry point for history */
+ history_gfun_t h_first; /* Get the first element */
+ history_gfun_t h_next; /* Get the next element */
+ history_gfun_t h_last; /* Get the last element */
+ history_gfun_t h_prev; /* Get the previous element */
+ history_gfun_t h_curr; /* Get the current element */
+ history_sfun_t h_set; /* Set the current element */
+ history_sfun_t h_del; /* Set the given element */
+ history_vfun_t h_clear; /* Clear the history list */
+ history_efun_t h_enter; /* Add an element */
+ history_efun_t h_add; /* Append to an element */
+};
+
+#define HNEXT(h, ev) (*(h)->h_next)((h)->h_ref, ev)
+#define HFIRST(h, ev) (*(h)->h_first)((h)->h_ref, ev)
+#define HPREV(h, ev) (*(h)->h_prev)((h)->h_ref, ev)
+#define HLAST(h, ev) (*(h)->h_last)((h)->h_ref, ev)
+#define HCURR(h, ev) (*(h)->h_curr)((h)->h_ref, ev)
+#define HSET(h, ev, n) (*(h)->h_set)((h)->h_ref, ev, n)
+#define HCLEAR(h, ev) (*(h)->h_clear)((h)->h_ref, ev)
+#define HENTER(h, ev, str) (*(h)->h_enter)((h)->h_ref, ev, str)
+#define HADD(h, ev, str) (*(h)->h_add)((h)->h_ref, ev, str)
+#define HDEL(h, ev, n) (*(h)->h_del)((h)->h_ref, ev, n)
+
+#define h_strdup(a) strdup(a)
+#define h_malloc(a) malloc(a)
+#define h_realloc(a, b) realloc((a), (b))
+#define h_free(a) free(a)
+
+typedef struct {
+ int num;
+ char *str;
+} HistEventPrivate;
+
+
+
+private int history_setsize(History *, HistEvent *, int);
+private int history_getsize(History *, HistEvent *);
+private int history_setunique(History *, HistEvent *, int);
+private int history_getunique(History *, HistEvent *);
+private int history_set_fun(History *, History *);
+private int history_load(History *, const char *);
+private int history_save(History *, const char *);
+private int history_prev_event(History *, HistEvent *, int);
+private int history_next_event(History *, HistEvent *, int);
+private int history_next_string(History *, HistEvent *, const char *);
+private int history_prev_string(History *, HistEvent *, const char *);
+
+
+/***********************************************************************/
+
+/*
+ * Builtin- history implementation
+ */
+typedef struct hentry_t {
+ HistEvent ev; /* What we return */
+ struct hentry_t *next; /* Next entry */
+ struct hentry_t *prev; /* Previous entry */
+} hentry_t;
+
+typedef struct history_t {
+ hentry_t list; /* Fake list header element */
+ hentry_t *cursor; /* Current element in the list */
+ int max; /* Maximum number of events */
+ int cur; /* Current number of events */
+ int eventid; /* For generation of unique event id */
+ int flags; /* History flags */
+#define H_UNIQUE 1 /* Store only unique elements */
+} history_t;
+
+private int history_def_next(ptr_t, HistEvent *);
+private int history_def_first(ptr_t, HistEvent *);
+private int history_def_prev(ptr_t, HistEvent *);
+private int history_def_last(ptr_t, HistEvent *);
+private int history_def_curr(ptr_t, HistEvent *);
+private int history_def_set(ptr_t, HistEvent *, const int);
+private void history_def_clear(ptr_t, HistEvent *);
+private int history_def_enter(ptr_t, HistEvent *, const char *);
+private int history_def_add(ptr_t, HistEvent *, const char *);
+private int history_def_del(ptr_t, HistEvent *, const int);
+
+private int history_def_init(ptr_t *, HistEvent *, int);
+private int history_def_insert(history_t *, HistEvent *, const char *);
+private void history_def_delete(history_t *, HistEvent *, hentry_t *);
+
+#define history_def_setsize(p, num)(void) (((history_t *)p)->max = (num))
+#define history_def_getsize(p) (((history_t *)p)->cur)
+#define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE) != 0)
+#define history_def_setunique(p, uni) \
+ if (uni) \
+ (((history_t *)p)->flags) |= H_UNIQUE; \
+ else \
+ (((history_t *)p)->flags) &= ~H_UNIQUE
+
+#define he_strerror(code) he_errlist[code]
+#define he_seterrev(evp, code) {\
+ evp->num = code;\
+ evp->str = he_strerror(code);\
+ }
+
+/* error messages */
+static const char *const he_errlist[] = {
+ "OK",
+ "unknown error",
+ "malloc() failed",
+ "first event not found",
+ "last event not found",
+ "empty list",
+ "no next event",
+ "no previous event",
+ "current event is invalid",
+ "event not found",
+ "can't read history from file",
+ "can't write history",
+ "required parameter(s) not supplied",
+ "history size negative",
+ "function not allowed with other history-functions-set the default",
+ "bad parameters"
+};
+/* error codes */
+#define _HE_OK 0
+#define _HE_UNKNOWN 1
+#define _HE_MALLOC_FAILED 2
+#define _HE_FIRST_NOTFOUND 3
+#define _HE_LAST_NOTFOUND 4
+#define _HE_EMPTY_LIST 5
+#define _HE_END_REACHED 6
+#define _HE_START_REACHED 7
+#define _HE_CURR_INVALID 8
+#define _HE_NOT_FOUND 9
+#define _HE_HIST_READ 10
+#define _HE_HIST_WRITE 11
+#define _HE_PARAM_MISSING 12
+#define _HE_SIZE_NEGATIVE 13
+#define _HE_NOT_ALLOWED 14
+#define _HE_BAD_PARAM 15
+
+/* history_def_first():
+ * Default function to return the first event in the history.
+ */
+private int
+history_def_first(ptr_t p, HistEvent *ev)
+{
+ history_t *h = (history_t *) p;
+
+ h->cursor = h->list.next;
+ if (h->cursor != &h->list)
+ *ev = h->cursor->ev;
+ else {
+ he_seterrev(ev, _HE_FIRST_NOTFOUND);
+ return (-1);
+ }
+
+ return (0);
+}
+
+
+/* history_def_last():
+ * Default function to return the last event in the history.
+ */
+private int
+history_def_last(ptr_t p, HistEvent *ev)
+{
+ history_t *h = (history_t *) p;
+
+ h->cursor = h->list.prev;
+ if (h->cursor != &h->list)
+ *ev = h->cursor->ev;
+ else {
+ he_seterrev(ev, _HE_LAST_NOTFOUND);
+ return (-1);
+ }
+
+ return (0);
+}
+
+
+/* history_def_next():
+ * Default function to return the next event in the history.
+ */
+private int
+history_def_next(ptr_t p, HistEvent *ev)
+{
+ history_t *h = (history_t *) p;
+
+ if (h->cursor == &h->list) {
+ he_seterrev(ev, _HE_EMPTY_LIST);
+ return (-1);
+ }
+
+ if (h->cursor->next == &h->list) {
+ he_seterrev(ev, _HE_END_REACHED);
+ return (-1);
+ }
+
+ h->cursor = h->cursor->next;
+ *ev = h->cursor->ev;
+
+ return (0);
+}
+
+
+/* history_def_prev():
+ * Default function to return the previous event in the history.
+ */
+private int
+history_def_prev(ptr_t p, HistEvent *ev)
+{
+ history_t *h = (history_t *) p;
+
+ if (h->cursor == &h->list) {
+ he_seterrev(ev,
+ (h->cur > 0) ? _HE_END_REACHED : _HE_EMPTY_LIST);
+ return (-1);
+ }
+
+ if (h->cursor->prev == &h->list) {
+ he_seterrev(ev, _HE_START_REACHED);
+ return (-1);
+ }
+
+ h->cursor = h->cursor->prev;
+ *ev = h->cursor->ev;
+
+ return (0);
+}
+
+
+/* history_def_curr():
+ * Default function to return the current event in the history.
+ */
+private int
+history_def_curr(ptr_t p, HistEvent *ev)
+{
+ history_t *h = (history_t *) p;
+
+ if (h->cursor != &h->list)
+ *ev = h->cursor->ev;
+ else {
+ he_seterrev(ev,
+ (h->cur > 0) ? _HE_CURR_INVALID : _HE_EMPTY_LIST);
+ return (-1);
+ }
+
+ return (0);
+}
+
+
+/* history_def_set():
+ * Default function to set the current event in the history to the
+ * given one.
+ */
+private int
+history_def_set(ptr_t p, HistEvent *ev, const int n)
+{
+ history_t *h = (history_t *) p;
+
+ if (h->cur == 0) {
+ he_seterrev(ev, _HE_EMPTY_LIST);
+ return (-1);
+ }
+ if (h->cursor == &h->list || h->cursor->ev.num != n) {
+ for (h->cursor = h->list.next; h->cursor != &h->list;
+ h->cursor = h->cursor->next)
+ if (h->cursor->ev.num == n)
+ break;
+ }
+ if (h->cursor == &h->list) {
+ he_seterrev(ev, _HE_NOT_FOUND);
+ return (-1);
+ }
+ return (0);
+}
+
+
+/* history_def_add():
+ * Append string to element
+ */
+private int
+history_def_add(ptr_t p, HistEvent *ev, const char *str)
+{
+ history_t *h = (history_t *) p;
+ size_t len;
+ char *s;
+ HistEventPrivate *evp = (void *)&h->cursor->ev;
+
+ if (h->cursor == &h->list)
+ return (history_def_enter(p, ev, str));
+ len = strlen(evp->str) + strlen(str) + 1;
+ s = (char *) h_malloc(len);
+ if (s == NULL) {
+ he_seterrev(ev, _HE_MALLOC_FAILED);
+ return (-1);
+ }
+ (void) strlcpy(s, h->cursor->ev.str, len);
+ (void) strlcat(s, str, len);
+ h_free((ptr_t)evp->str);
+ evp->str = s;
+ *ev = h->cursor->ev;
+ return (0);
+}
+
+
+/* history_def_del():
+ * Delete element hp of the h list
+ */
+/* ARGSUSED */
+private int
+history_def_del(ptr_t p, HistEvent *ev __attribute__((__unused__)),
+ const int num)
+{
+ history_t *h = (history_t *) p;
+ if (history_def_set(h, ev, num) != 0)
+ return (-1);
+ ev->str = strdup(h->cursor->ev.str);
+ ev->num = h->cursor->ev.num;
+ history_def_delete(h, ev, h->cursor);
+ return (0);
+}
+
+
+/* history_def_delete():
+ * Delete element hp of the h list
+ */
+/* ARGSUSED */
+private void
+history_def_delete(history_t *h,
+ HistEvent *ev __attribute__((__unused__)), hentry_t *hp)
+{
+ HistEventPrivate *evp = (void *)&hp->ev;
+ if (hp == &h->list)
+ abort();
+ if (h->cursor == hp)
+ h->cursor = hp->prev;
+ hp->prev->next = hp->next;
+ hp->next->prev = hp->prev;
+ h_free((ptr_t) evp->str);
+ h_free(hp);
+ h->cur--;
+}
+
+
+/* history_def_insert():
+ * Insert element with string str in the h list
+ */
+private int
+history_def_insert(history_t *h, HistEvent *ev, const char *str)
+{
+
+ h->cursor = (hentry_t *) h_malloc(sizeof(hentry_t));
+ if (h->cursor == NULL)
+ goto oomem;
+ if ((h->cursor->ev.str = h_strdup(str)) == NULL) {
+ h_free((ptr_t)h->cursor);
+ goto oomem;
+ }
+ h->cursor->ev.num = ++h->eventid;
+ h->cursor->next = h->list.next;
+ h->cursor->prev = &h->list;
+ h->list.next->prev = h->cursor;
+ h->list.next = h->cursor;
+ h->cur++;
+
+ *ev = h->cursor->ev;
+ return (0);
+oomem:
+ he_seterrev(ev, _HE_MALLOC_FAILED);
+ return (-1);
+}
+
+
+/* history_def_enter():
+ * Default function to enter an item in the history
+ */
+private int
+history_def_enter(ptr_t p, HistEvent *ev, const char *str)
+{
+ history_t *h = (history_t *) p;
+
+ if ((h->flags & H_UNIQUE) != 0 && h->list.next != &h->list &&
+ strcmp(h->list.next->ev.str, str) == 0)
+ return (0);
+
+ if (history_def_insert(h, ev, str) == -1)
+ return (-1); /* error, keep error message */
+
+ /*
+ * Always keep at least one entry.
+ * This way we don't have to check for the empty list.
+ */
+ while (h->cur > h->max && h->cur > 0)
+ history_def_delete(h, ev, h->list.prev);
+
+ return (1);
+}
+
+
+/* history_def_init():
+ * Default history initialization function
+ */
+/* ARGSUSED */
+private int
+history_def_init(ptr_t *p, HistEvent *ev __attribute__((__unused__)), int n)
+{
+ history_t *h = (history_t *) h_malloc(sizeof(history_t));
+ if (h == NULL)
+ return -1;
+
+ if (n <= 0)
+ n = 0;
+ h->eventid = 0;
+ h->cur = 0;
+ h->max = n;
+ h->list.next = h->list.prev = &h->list;
+ h->list.ev.str = NULL;
+ h->list.ev.num = 0;
+ h->cursor = &h->list;
+ h->flags = 0;
+ *p = (ptr_t) h;
+ return 0;
+}
+
+
+/* history_def_clear():
+ * Default history cleanup function
+ */
+private void
+history_def_clear(ptr_t p, HistEvent *ev)
+{
+ history_t *h = (history_t *) p;
+
+ while (h->list.prev != &h->list)
+ history_def_delete(h, ev, h->list.prev);
+ h->eventid = 0;
+ h->cur = 0;
+}
+
+
+
+
+/************************************************************************/
+
+/* history_init():
+ * Initialization function.
+ */
+public History *
+history_init(void)
+{
+ HistEvent ev;
+ History *h = (History *) h_malloc(sizeof(History));
+ if (h == NULL)
+ return NULL;
+
+ if (history_def_init(&h->h_ref, &ev, 0) == -1) {
+ h_free((ptr_t)h);
+ return NULL;
+ }
+ h->h_ent = -1;
+ h->h_next = history_def_next;
+ h->h_first = history_def_first;
+ h->h_last = history_def_last;
+ h->h_prev = history_def_prev;
+ h->h_curr = history_def_curr;
+ h->h_set = history_def_set;
+ h->h_clear = history_def_clear;
+ h->h_enter = history_def_enter;
+ h->h_add = history_def_add;
+ h->h_del = history_def_del;
+
+ return (h);
+}
+
+
+/* history_end():
+ * clean up history;
+ */
+public void
+history_end(History *h)
+{
+ HistEvent ev;
+
+ if (h->h_next == history_def_next)
+ history_def_clear(h->h_ref, &ev);
+ h_free(h->h_ref);
+ h_free(h);
+}
+
+
+
+/* history_setsize():
+ * Set history number of events
+ */
+private int
+history_setsize(History *h, HistEvent *ev, int num)
+{
+
+ if (h->h_next != history_def_next) {
+ he_seterrev(ev, _HE_NOT_ALLOWED);
+ return (-1);
+ }
+ if (num < 0) {
+ he_seterrev(ev, _HE_BAD_PARAM);
+ return (-1);
+ }
+ history_def_setsize(h->h_ref, num);
+ return (0);
+}
+
+
+/* history_getsize():
+ * Get number of events currently in history
+ */
+private int
+history_getsize(History *h, HistEvent *ev)
+{
+ if (h->h_next != history_def_next) {
+ he_seterrev(ev, _HE_NOT_ALLOWED);
+ return (-1);
+ }
+ ev->num = history_def_getsize(h->h_ref);
+ if (ev->num < -1) {
+ he_seterrev(ev, _HE_SIZE_NEGATIVE);
+ return (-1);
+ }
+ return (0);
+}
+
+
+/* history_setunique():
+ * Set if adjacent equal events should not be entered in history.
+ */
+private int
+history_setunique(History *h, HistEvent *ev, int uni)
+{
+
+ if (h->h_next != history_def_next) {
+ he_seterrev(ev, _HE_NOT_ALLOWED);
+ return (-1);
+ }
+ history_def_setunique(h->h_ref, uni);
+ return (0);
+}
+
+
+/* history_getunique():
+ * Get if adjacent equal events should not be entered in history.
+ */
+private int
+history_getunique(History *h, HistEvent *ev)
+{
+ if (h->h_next != history_def_next) {
+ he_seterrev(ev, _HE_NOT_ALLOWED);
+ return (-1);
+ }
+ ev->num = history_def_getunique(h->h_ref);
+ return (0);
+}
+
+
+/* history_set_fun():
+ * Set history functions
+ */
+private int
+history_set_fun(History *h, History *nh)
+{
+ HistEvent ev;
+
+ if (nh->h_first == NULL || nh->h_next == NULL || nh->h_last == NULL ||
+ nh->h_prev == NULL || nh->h_curr == NULL || nh->h_set == NULL ||
+ nh->h_enter == NULL || nh->h_add == NULL || nh->h_clear == NULL ||
+ nh->h_del == NULL || nh->h_ref == NULL) {
+ if (h->h_next != history_def_next) {
+ history_def_init(&h->h_ref, &ev, 0);
+ h->h_first = history_def_first;
+ h->h_next = history_def_next;
+ h->h_last = history_def_last;
+ h->h_prev = history_def_prev;
+ h->h_curr = history_def_curr;
+ h->h_set = history_def_set;
+ h->h_clear = history_def_clear;
+ h->h_enter = history_def_enter;
+ h->h_add = history_def_add;
+ h->h_del = history_def_del;
+ }
+ return (-1);
+ }
+ if (h->h_next == history_def_next)
+ history_def_clear(h->h_ref, &ev);
+
+ h->h_ent = -1;
+ h->h_first = nh->h_first;
+ h->h_next = nh->h_next;
+ h->h_last = nh->h_last;
+ h->h_prev = nh->h_prev;
+ h->h_curr = nh->h_curr;
+ h->h_set = nh->h_set;
+ h->h_clear = nh->h_clear;
+ h->h_enter = nh->h_enter;
+ h->h_add = nh->h_add;
+ h->h_del = nh->h_del;
+
+ return (0);
+}
+
+
+/* history_load():
+ * History load function
+ */
+private int
+history_load(History *h, const char *fname)
+{
+ FILE *fp;
+ char *line;
+ size_t sz, max_size;
+ char *ptr;
+ int i = -1;
+ HistEvent ev;
+
+ if ((fp = fopen(fname, "r")) == NULL)
+ return (i);
+
+ if ((line = fgetln(fp, &sz)) == NULL)
+ goto done;
+
+ if (strncmp(line, hist_cookie, sz) != 0)
+ goto done;
+
+ ptr = h_malloc(max_size = 1024);
+ if (ptr == NULL)
+ goto done;
+ for (i = 0; (line = fgetln(fp, &sz)) != NULL; i++) {
+ char c = line[sz];
+
+ if (sz != 0 && line[sz - 1] == '\n')
+ line[--sz] = '\0';
+ else
+ line[sz] = '\0';
+
+ if (max_size < sz) {
+ char *nptr;
+ max_size = (sz + 1024) & ~1023;
+ nptr = h_realloc(ptr, max_size);
+ if (nptr == NULL) {
+ i = -1;
+ goto oomem;
+ }
+ ptr = nptr;
+ }
+ (void) strunvis(ptr, line);
+ line[sz] = c;
+ if (HENTER(h, &ev, ptr) == -1) {
+ h_free((ptr_t)ptr);
+ return -1;
+ }
+ }
+oomem:
+ h_free((ptr_t)ptr);
+done:
+ (void) fclose(fp);
+ return (i);
+}
+
+
+/* history_save():
+ * History save function
+ */
+private int
+history_save(History *h, const char *fname)
+{
+ FILE *fp;
+ HistEvent ev;
+ int i = -1, retval;
+ size_t len, max_size;
+ char *ptr;
+
+ if ((fp = fopen(fname, "w")) == NULL)
+ return (-1);
+
+ if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
+ goto done;
+ if (fputs(hist_cookie, fp) == EOF)
+ goto done;
+ ptr = h_malloc(max_size = 1024);
+ if (ptr == NULL)
+ goto done;
+ for (i = 0, retval = HLAST(h, &ev);
+ retval != -1;
+ retval = HPREV(h, &ev), i++) {
+ len = strlen(ev.str) * 4;
+ if (len >= max_size) {
+ char *nptr;
+ max_size = (len + 1024) & ~1023;
+ nptr = h_realloc(ptr, max_size);
+ if (nptr == NULL) {
+ i = -1;
+ goto oomem;
+ }
+ ptr = nptr;
+ }
+ (void) strvis(ptr, ev.str, VIS_WHITE);
+ (void) fprintf(fp, "%s\n", ptr);
+ }
+oomem:
+ h_free((ptr_t)ptr);
+done:
+ (void) fclose(fp);
+ return (i);
+}
+
+
+/* history_prev_event():
+ * Find the previous event, with number given
+ */
+private int
+history_prev_event(History *h, HistEvent *ev, int num)
+{
+ int retval;
+
+ for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev))
+ if (ev->num == num)
+ return (0);
+
+ he_seterrev(ev, _HE_NOT_FOUND);
+ return (-1);
+}
+
+
+/* history_next_event():
+ * Find the next event, with number given
+ */
+private int
+history_next_event(History *h, HistEvent *ev, int num)
+{
+ int retval;
+
+ for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev))
+ if (ev->num == num)
+ return (0);
+
+ he_seterrev(ev, _HE_NOT_FOUND);
+ return (-1);
+}
+
+
+/* history_prev_string():
+ * Find the previous event beginning with string
+ */
+private int
+history_prev_string(History *h, HistEvent *ev, const char *str)
+{
+ size_t len = strlen(str);
+ int retval;
+
+ for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev))
+ if (strncmp(str, ev->str, len) == 0)
+ return (0);
+
+ he_seterrev(ev, _HE_NOT_FOUND);
+ return (-1);
+}
+
+
+/* history_next_string():
+ * Find the next event beginning with string
+ */
+private int
+history_next_string(History *h, HistEvent *ev, const char *str)
+{
+ size_t len = strlen(str);
+ int retval;
+
+ for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev))
+ if (strncmp(str, ev->str, len) == 0)
+ return (0);
+
+ he_seterrev(ev, _HE_NOT_FOUND);
+ return (-1);
+}
+
+
+/* history():
+ * User interface to history functions.
+ */
+int
+history(History *h, HistEvent *ev, int fun, ...)
+{
+ va_list va;
+ const char *str;
+ int retval;
+
+ va_start(va, fun);
+
+ he_seterrev(ev, _HE_OK);
+
+ switch (fun) {
+ case H_GETSIZE:
+ retval = history_getsize(h, ev);
+ break;
+
+ case H_SETSIZE:
+ retval = history_setsize(h, ev, va_arg(va, int));
+ break;
+
+ case H_GETUNIQUE:
+ retval = history_getunique(h, ev);
+ break;
+
+ case H_SETUNIQUE:
+ retval = history_setunique(h, ev, va_arg(va, int));
+ break;
+
+ case H_ADD:
+ str = va_arg(va, const char *);
+ retval = HADD(h, ev, str);
+ break;
+
+ case H_DEL:
+ retval = HDEL(h, ev, va_arg(va, const int));
+ break;
+
+ case H_ENTER:
+ str = va_arg(va, const char *);
+ if ((retval = HENTER(h, ev, str)) != -1)
+ h->h_ent = ev->num;
+ break;
+
+ case H_APPEND:
+ str = va_arg(va, const char *);
+ if ((retval = HSET(h, ev, h->h_ent)) != -1)
+ retval = HADD(h, ev, str);
+ break;
+
+ case H_FIRST:
+ retval = HFIRST(h, ev);
+ break;
+
+ case H_NEXT:
+ retval = HNEXT(h, ev);
+ break;
+
+ case H_LAST:
+ retval = HLAST(h, ev);
+ break;
+
+ case H_PREV:
+ retval = HPREV(h, ev);
+ break;
+
+ case H_CURR:
+ retval = HCURR(h, ev);
+ break;
+
+ case H_SET:
+ retval = HSET(h, ev, va_arg(va, const int));
+ break;
+
+ case H_CLEAR:
+ HCLEAR(h, ev);
+ retval = 0;
+ break;
+
+ case H_LOAD:
+ retval = history_load(h, va_arg(va, const char *));
+ if (retval == -1)
+ he_seterrev(ev, _HE_HIST_READ);
+ break;
+
+ case H_SAVE:
+ retval = history_save(h, va_arg(va, const char *));
+ if (retval == -1)
+ he_seterrev(ev, _HE_HIST_WRITE);
+ break;
+
+ case H_PREV_EVENT:
+ retval = history_prev_event(h, ev, va_arg(va, int));
+ break;
+
+ case H_NEXT_EVENT:
+ retval = history_next_event(h, ev, va_arg(va, int));
+ break;
+
+ case H_PREV_STR:
+ retval = history_prev_string(h, ev, va_arg(va, const char *));
+ break;
+
+ case H_NEXT_STR:
+ retval = history_next_string(h, ev, va_arg(va, const char *));
+ break;
+
+ case H_FUNC:
+ {
+ History hf;
+
+ hf.h_ref = va_arg(va, ptr_t);
+ h->h_ent = -1;
+ hf.h_first = va_arg(va, history_gfun_t);
+ hf.h_next = va_arg(va, history_gfun_t);
+ hf.h_last = va_arg(va, history_gfun_t);
+ hf.h_prev = va_arg(va, history_gfun_t);
+ hf.h_curr = va_arg(va, history_gfun_t);
+ hf.h_set = va_arg(va, history_sfun_t);
+ hf.h_clear = va_arg(va, history_vfun_t);
+ hf.h_enter = va_arg(va, history_efun_t);
+ hf.h_add = va_arg(va, history_efun_t);
+ hf.h_del = va_arg(va, history_sfun_t);
+
+ if ((retval = history_set_fun(h, &hf)) == -1)
+ he_seterrev(ev, _HE_PARAM_MISSING);
+ break;
+ }
+
+ case H_END:
+ history_end(h);
+ retval = 0;
+ break;
+
+ default:
+ retval = -1;
+ he_seterrev(ev, _HE_UNKNOWN);
+ break;
+ }
+ va_end(va);
+ return (retval);
+}
diff --git a/frontend/libedit/key.c b/frontend/libedit/key.c
new file mode 100644
index 0000000..099434e
--- /dev/null
+++ b/frontend/libedit/key.c
@@ -0,0 +1,700 @@
+/* $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * key.c: This module contains the procedures for maintaining
+ * the extended-key map.
+ *
+ * An extended-key (key) is a sequence of keystrokes introduced
+ * with a sequence introducer and consisting of an arbitrary
+ * number of characters. This module maintains a map (the el->el_key.map)
+ * to convert these extended-key sequences into input strs
+ * (XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE).
+ *
+ * Warning:
+ * If key is a substr of some other keys, then the longer
+ * keys are lost!! That is, if the keys "abcd" and "abcef"
+ * are in el->el_key.map, adding the key "abc" will cause the first two
+ * definitions to be lost.
+ *
+ * Restrictions:
+ * -------------
+ * 1) It is not possible to have one key that is a
+ * substr of another.
+ */
+#include <string.h>
+#include <stdlib.h>
+
+#include "el.h"
+
+/*
+ * The Nodes of the el->el_key.map. The el->el_key.map is a linked list
+ * of these node elements
+ */
+struct key_node_t {
+ char ch; /* single character of key */
+ int type; /* node type */
+ key_value_t val; /* command code or pointer to str, */
+ /* if this is a leaf */
+ struct key_node_t *next; /* ptr to next char of this key */
+ struct key_node_t *sibling; /* ptr to another key with same prefix*/
+};
+
+private int node_trav(EditLine *, key_node_t *, char *,
+ key_value_t *);
+private int node__try(EditLine *, key_node_t *, const char *,
+ key_value_t *, int);
+private key_node_t *node__get(int);
+private void node__free(key_node_t *);
+private void node__put(EditLine *, key_node_t *);
+private int node__delete(EditLine *, key_node_t **, const char *);
+private int node_lookup(EditLine *, const char *, key_node_t *,
+ int);
+private int node_enum(EditLine *, key_node_t *, int);
+
+#define KEY_BUFSIZ EL_BUFSIZ
+
+
+/* key_init():
+ * Initialize the key maps
+ */
+protected int
+key_init(EditLine *el)
+{
+
+ el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ);
+ if (el->el_key.buf == NULL)
+ return (-1);
+ el->el_key.map = NULL;
+ key_reset(el);
+ return (0);
+}
+
+/* key_end():
+ * Free the key maps
+ */
+protected void
+key_end(EditLine *el)
+{
+
+ el_free((ptr_t) el->el_key.buf);
+ el->el_key.buf = NULL;
+ node__free(el->el_key.map);
+}
+
+
+/* key_map_cmd():
+ * Associate cmd with a key value
+ */
+protected key_value_t *
+key_map_cmd(EditLine *el, int cmd)
+{
+
+ el->el_key.val.cmd = (el_action_t) cmd;
+ return (&el->el_key.val);
+}
+
+
+/* key_map_str():
+ * Associate str with a key value
+ */
+protected key_value_t *
+key_map_str(EditLine *el, char *str)
+{
+
+ el->el_key.val.str = str;
+ return (&el->el_key.val);
+}
+
+
+/* key_reset():
+ * Takes all nodes on el->el_key.map and puts them on free list. Then
+ * initializes el->el_key.map with arrow keys
+ * [Always bind the ansi arrow keys?]
+ */
+protected void
+key_reset(EditLine *el)
+{
+
+ node__put(el, el->el_key.map);
+ el->el_key.map = NULL;
+ return;
+}
+
+
+/* key_get():
+ * Calls the recursive function with entry point el->el_key.map
+ * Looks up *ch in map and then reads characters until a
+ * complete match is found or a mismatch occurs. Returns the
+ * type of the match found (XK_STR, XK_CMD, or XK_EXE).
+ * Returns NULL in val.str and XK_STR for no match.
+ * The last character read is returned in *ch.
+ */
+protected int
+key_get(EditLine *el, char *ch, key_value_t *val)
+{
+
+ return (node_trav(el, el->el_key.map, ch, val));
+}
+
+
+/* key_add():
+ * Adds key to the el->el_key.map and associates the value in val with it.
+ * If key is already is in el->el_key.map, the new code is applied to the
+ * existing key. Ntype specifies if code is a command, an
+ * out str or a unix command.
+ */
+protected void
+key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
+{
+
+ if (key[0] == '\0') {
+ (void) fprintf(el->el_errfile,
+ "key_add: Null extended-key not allowed.\n");
+ return;
+ }
+ if (ntype == XK_CMD && val->cmd == ED_SEQUENCE_LEAD_IN) {
+ (void) fprintf(el->el_errfile,
+ "key_add: sequence-lead-in command not allowed\n");
+ return;
+ }
+ if (el->el_key.map == NULL)
+ /* tree is initially empty. Set up new node to match key[0] */
+ el->el_key.map = node__get(key[0]);
+ /* it is properly initialized */
+
+ /* Now recurse through el->el_key.map */
+ (void) node__try(el, el->el_key.map, key, val, ntype);
+ return;
+}
+
+
+/* key_clear():
+ *
+ */
+protected void
+key_clear(EditLine *el, el_action_t *map, const char *in)
+{
+
+ if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
+ ((map == el->el_map.key &&
+ el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
+ (map == el->el_map.alt &&
+ el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN)))
+ (void) key_delete(el, in);
+}
+
+
+/* key_delete():
+ * Delete the key and all longer keys staring with key, if
+ * they exists.
+ */
+protected int
+key_delete(EditLine *el, const char *key)
+{
+
+ if (key[0] == '\0') {
+ (void) fprintf(el->el_errfile,
+ "key_delete: Null extended-key not allowed.\n");
+ return (-1);
+ }
+ if (el->el_key.map == NULL)
+ return (0);
+
+ (void) node__delete(el, &el->el_key.map, key);
+ return (0);
+}
+
+
+/* key_print():
+ * Print the binding associated with key key.
+ * Print entire el->el_key.map if null
+ */
+protected void
+key_print(EditLine *el, const char *key)
+{
+
+ /* do nothing if el->el_key.map is empty and null key specified */
+ if (el->el_key.map == NULL && *key == 0)
+ return;
+
+ el->el_key.buf[0] = '"';
+ if (node_lookup(el, key, el->el_key.map, 1) <= -1)
+ /* key is not bound */
+ (void) fprintf(el->el_errfile, "Unbound extended key \"%s\"\n",
+ key);
+ return;
+}
+
+
+/* node_trav():
+ * recursively traverses node in tree until match or mismatch is
+ * found. May read in more characters.
+ */
+private int
+node_trav(EditLine *el, key_node_t *ptr, char *ch, key_value_t *val)
+{
+
+ if (ptr->ch == *ch) {
+ /* match found */
+ if (ptr->next) {
+ /* key not complete so get next char */
+ if (el_getc(el, ch) != 1) { /* if EOF or error */
+ val->cmd = ED_END_OF_FILE;
+ return (XK_CMD);
+ /* PWP: Pretend we just read an end-of-file */
+ }
+ return (node_trav(el, ptr->next, ch, val));
+ } else {
+ *val = ptr->val;
+ if (ptr->type != XK_CMD)
+ *ch = '\0';
+ return (ptr->type);
+ }
+ } else {
+ /* no match found here */
+ if (ptr->sibling) {
+ /* try next sibling */
+ return (node_trav(el, ptr->sibling, ch, val));
+ } else {
+ /* no next sibling -- mismatch */
+ val->str = NULL;
+ return (XK_STR);
+ }
+ }
+}
+
+
+/* node__try():
+ * Find a node that matches *str or allocate a new one
+ */
+private int
+node__try(EditLine *el, key_node_t *ptr, const char *str, key_value_t *val, int ntype)
+{
+
+ if (ptr->ch != *str) {
+ key_node_t *xm;
+
+ for (xm = ptr; xm->sibling != NULL; xm = xm->sibling)
+ if (xm->sibling->ch == *str)
+ break;
+ if (xm->sibling == NULL)
+ xm->sibling = node__get(*str); /* setup new node */
+ ptr = xm->sibling;
+ }
+ if (*++str == '\0') {
+ /* we're there */
+ if (ptr->next != NULL) {
+ node__put(el, ptr->next);
+ /* lose longer keys with this prefix */
+ ptr->next = NULL;
+ }
+ switch (ptr->type) {
+ case XK_CMD:
+ case XK_NOD:
+ break;
+ case XK_STR:
+ case XK_EXE:
+ if (ptr->val.str)
+ el_free((ptr_t) ptr->val.str);
+ break;
+ default:
+ EL_ABORT((el->el_errfile, "Bad XK_ type %d\n",
+ ptr->type));
+ break;
+ }
+
+ switch (ptr->type = ntype) {
+ case XK_CMD:
+ ptr->val = *val;
+ break;
+ case XK_STR:
+ case XK_EXE:
+ if ((ptr->val.str = el_strdup(val->str)) == NULL)
+ return -1;
+ break;
+ default:
+ EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
+ break;
+ }
+ } else {
+ /* still more chars to go */
+ if (ptr->next == NULL)
+ ptr->next = node__get(*str); /* setup new node */
+ (void) node__try(el, ptr->next, str, val, ntype);
+ }
+ return (0);
+}
+
+
+/* node__delete():
+ * Delete node that matches str
+ */
+private int
+node__delete(EditLine *el, key_node_t **inptr, const char *str)
+{
+ key_node_t *ptr;
+ key_node_t *prev_ptr = NULL;
+
+ ptr = *inptr;
+
+ if (ptr->ch != *str) {
+ key_node_t *xm;
+
+ for (xm = ptr; xm->sibling != NULL; xm = xm->sibling)
+ if (xm->sibling->ch == *str)
+ break;
+ if (xm->sibling == NULL)
+ return (0);
+ prev_ptr = xm;
+ ptr = xm->sibling;
+ }
+ if (*++str == '\0') {
+ /* we're there */
+ if (prev_ptr == NULL)
+ *inptr = ptr->sibling;
+ else
+ prev_ptr->sibling = ptr->sibling;
+ ptr->sibling = NULL;
+ node__put(el, ptr);
+ return (1);
+ } else if (ptr->next != NULL &&
+ node__delete(el, &ptr->next, str) == 1) {
+ if (ptr->next != NULL)
+ return (0);
+ if (prev_ptr == NULL)
+ *inptr = ptr->sibling;
+ else
+ prev_ptr->sibling = ptr->sibling;
+ ptr->sibling = NULL;
+ node__put(el, ptr);
+ return (1);
+ } else {
+ return (0);
+ }
+}
+
+
+/* node__put():
+ * Puts a tree of nodes onto free list using free(3).
+ */
+private void
+node__put(EditLine *el, key_node_t *ptr)
+{
+ if (ptr == NULL)
+ return;
+
+ if (ptr->next != NULL) {
+ node__put(el, ptr->next);
+ ptr->next = NULL;
+ }
+ node__put(el, ptr->sibling);
+
+ switch (ptr->type) {
+ case XK_CMD:
+ case XK_NOD:
+ break;
+ case XK_EXE:
+ case XK_STR:
+ if (ptr->val.str != NULL)
+ el_free((ptr_t) ptr->val.str);
+ break;
+ default:
+ EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type));
+ break;
+ }
+ el_free((ptr_t) ptr);
+}
+
+
+/* node__get():
+ * Returns pointer to a key_node_t for ch.
+ */
+private key_node_t *
+node__get(int ch)
+{
+ key_node_t *ptr;
+
+ ptr = (key_node_t *) el_malloc((size_t) sizeof(key_node_t));
+ if (ptr == NULL)
+ return NULL;
+ ptr->ch = ch;
+ ptr->type = XK_NOD;
+ ptr->val.str = NULL;
+ ptr->next = NULL;
+ ptr->sibling = NULL;
+ return (ptr);
+}
+
+private void
+node__free(key_node_t *k)
+{
+ if (k == NULL)
+ return;
+ node__free(k->sibling);
+ node__free(k->next);
+ el_free((ptr_t) k);
+}
+
+/* node_lookup():
+ * look for the str starting at node ptr.
+ * Print if last node
+ */
+private int
+node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
+{
+ int ncnt;
+
+ if (ptr == NULL)
+ return (-1); /* cannot have null ptr */
+
+ if (*str == 0) {
+ /* no more chars in str. node_enum from here. */
+ (void) node_enum(el, ptr, cnt);
+ return (0);
+ } else {
+ /* If match put this char into el->el_key.buf. Recurse */
+ if (ptr->ch == *str) {
+ /* match found */
+ ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt,
+ (unsigned char) ptr->ch);
+ if (ptr->next != NULL)
+ /* not yet at leaf */
+ return (node_lookup(el, str + 1, ptr->next,
+ ncnt + 1));
+ else {
+ /* next node is null so key should be complete */
+ if (str[1] == 0) {
+ el->el_key.buf[ncnt + 1] = '"';
+ el->el_key.buf[ncnt + 2] = '\0';
+ key_kprint(el, el->el_key.buf,
+ &ptr->val, ptr->type);
+ return (0);
+ } else
+ return (-1);
+ /* mismatch -- str still has chars */
+ }
+ } else {
+ /* no match found try sibling */
+ if (ptr->sibling)
+ return (node_lookup(el, str, ptr->sibling,
+ cnt));
+ else
+ return (-1);
+ }
+ }
+}
+
+
+/* node_enum():
+ * Traverse the node printing the characters it is bound in buffer
+ */
+private int
+node_enum(EditLine *el, key_node_t *ptr, int cnt)
+{
+ int ncnt;
+
+ if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */
+ el->el_key.buf[++cnt] = '"';
+ el->el_key.buf[++cnt] = '\0';
+ (void) fprintf(el->el_errfile,
+ "Some extended keys too long for internal print buffer");
+ (void) fprintf(el->el_errfile, " \"%s...\"\n", el->el_key.buf);
+ return (0);
+ }
+ if (ptr == NULL) {
+#ifdef DEBUG_EDIT
+ (void) fprintf(el->el_errfile,
+ "node_enum: BUG!! Null ptr passed\n!");
+#endif
+ return (-1);
+ }
+ /* put this char at end of str */
+ ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt,
+ (unsigned char)ptr->ch);
+ if (ptr->next == NULL) {
+ /* print this key and function */
+ el->el_key.buf[ncnt + 1] = '"';
+ el->el_key.buf[ncnt + 2] = '\0';
+ key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
+ } else
+ (void) node_enum(el, ptr->next, ncnt + 1);
+
+ /* go to sibling if there is one */
+ if (ptr->sibling)
+ (void) node_enum(el, ptr->sibling, cnt);
+ return (0);
+}
+
+
+/* key_kprint():
+ * Print the specified key and its associated
+ * function specified by val
+ */
+protected void
+key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
+{
+ el_bindings_t *fp;
+ char unparsbuf[EL_BUFSIZ];
+ static const char fmt[] = "%-15s-> %s\n";
+
+ if (val != NULL)
+ switch (ntype) {
+ case XK_STR:
+ case XK_EXE:
+ (void) key__decode_str(val->str, unparsbuf,
+ sizeof(unparsbuf),
+ ntype == XK_STR ? "\"\"" : "[]");
+ (void) fprintf(el->el_outfile, fmt, key, unparsbuf);
+ break;
+ case XK_CMD:
+ for (fp = el->el_map.help; fp->name; fp++)
+ if (val->cmd == fp->func) {
+ (void) fprintf(el->el_outfile, fmt,
+ key, fp->name);
+ break;
+ }
+#ifdef DEBUG_KEY
+ if (fp->name == NULL)
+ (void) fprintf(el->el_outfile,
+ "BUG! Command not found.\n");
+#endif
+
+ break;
+ default:
+ EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
+ break;
+ }
+ else
+ (void) fprintf(el->el_outfile, fmt, key, "no input");
+}
+
+
+#define ADDC(c) \
+ if (b < eb) \
+ *b++ = c; \
+ else \
+ b++
+/* key__decode_char():
+ * Put a printable form of char in buf.
+ */
+protected int
+key__decode_char(char *buf, int cnt, int off, int ch)
+{
+ char *sb = buf + off;
+ char *eb = buf + cnt;
+ char *b = sb;
+ if (ch == 0) {
+ ADDC('^');
+ ADDC('@');
+ return b - sb;
+ }
+ if (iscntrl(ch)) {
+ ADDC('^');
+ if (ch == '\177')
+ ADDC('?');
+ else
+ ADDC(ch | 0100);
+ } else if (ch == '^') {
+ ADDC('\\');
+ ADDC('^');
+ } else if (ch == '\\') {
+ ADDC('\\');
+ ADDC('\\');
+ } else if (ch == ' ' || (isprint(ch) && !isspace(ch))) {
+ ADDC(ch);
+ } else {
+ ADDC('\\');
+ ADDC((((unsigned int) ch >> 6) & 7) + '0');
+ ADDC((((unsigned int) ch >> 3) & 7) + '0');
+ ADDC((ch & 7) + '0');
+ }
+ return b - sb;
+}
+
+
+/* key__decode_str():
+ * Make a printable version of the ey
+ */
+protected int
+key__decode_str(const char *str, char *buf, int len, const char *sep)
+{
+ char *b = buf, *eb = b + len;
+ const char *p;
+
+ b = buf;
+ if (sep[0] != '\0') {
+ ADDC(sep[0]);
+ }
+ if (*str == '\0') {
+ ADDC('^');
+ ADDC('@');
+ if (sep[0] != '\0' && sep[1] != '\0') {
+ ADDC(sep[1]);
+ }
+ goto done;
+ }
+ for (p = str; *p != 0; p++) {
+ if (iscntrl((unsigned char) *p)) {
+ ADDC('^');
+ if (*p == '\177') {
+ ADDC('?');
+ } else {
+ ADDC(*p | 0100);
+ }
+ } else if (*p == '^' || *p == '\\') {
+ ADDC('\\');
+ ADDC(*p);
+ } else if (*p == ' ' || (isprint((unsigned char) *p) &&
+ !isspace((unsigned char) *p))) {
+ ADDC(*p);
+ } else {
+ ADDC('\\');
+ ADDC((((unsigned int) *p >> 6) & 7) + '0');
+ ADDC((((unsigned int) *p >> 3) & 7) + '0');
+ ADDC((*p & 7) + '0');
+ }
+ }
+ if (sep[0] != '\0' && sep[1] != '\0') {
+ ADDC(sep[1]);
+ }
+done:
+ ADDC('\0');
+ if (b - buf >= len)
+ buf[len - 1] = '\0';
+ return b - buf;
+}
diff --git a/frontend/libedit/key.h b/frontend/libedit/key.h
new file mode 100644
index 0000000..9c6844e
--- /dev/null
+++ b/frontend/libedit/key.h
@@ -0,0 +1,81 @@
+/* $NetBSD: key.h,v 1.10 2006/03/23 20:22:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)key.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.key.h: Key macro header
+ */
+#ifndef _h_el_key
+#define _h_el_key
+
+typedef union key_value_t {
+ el_action_t cmd; /* If it is a command the # */
+ char *str; /* If it is a string... */
+} key_value_t;
+
+typedef struct key_node_t key_node_t;
+
+typedef struct el_key_t {
+ char *buf; /* Key print buffer */
+ key_node_t *map; /* Key map */
+ key_value_t val; /* Local conversion buffer */
+} el_key_t;
+
+#define XK_CMD 0
+#define XK_STR 1
+#define XK_NOD 2
+#define XK_EXE 3
+
+#undef key_end
+#undef key_clear
+#undef key_print
+
+protected int key_init(EditLine *);
+protected void key_end(EditLine *);
+protected key_value_t *key_map_cmd(EditLine *, int);
+protected key_value_t *key_map_str(EditLine *, char *);
+protected void key_reset(EditLine *);
+protected int key_get(EditLine *, char *, key_value_t *);
+protected void key_add(EditLine *, const char *, key_value_t *, int);
+protected void key_clear(EditLine *, el_action_t *, const char *);
+protected int key_delete(EditLine *, const char *);
+protected void key_print(EditLine *, const char *);
+protected void key_kprint(EditLine *, const char *, key_value_t *,
+ int);
+protected int key__decode_str(const char *, char *, int,
+ const char *);
+protected int key__decode_char(char *, int, int, int);
+
+#endif /* _h_el_key */
diff --git a/frontend/libedit/ldscript b/frontend/libedit/ldscript
new file mode 100644
index 0000000..fc4b4ed
--- /dev/null
+++ b/frontend/libedit/ldscript
@@ -0,0 +1,6 @@
+VER_1 {
+ global:
+ mono_debugger_readline_*;
+ local:
+ *;
+};
diff --git a/frontend/libedit/map.c b/frontend/libedit/map.c
new file mode 100644
index 0000000..89c76fa
--- /dev/null
+++ b/frontend/libedit/map.c
@@ -0,0 +1,1416 @@
+/* $NetBSD: map.c,v 1.24 2006/04/09 01:36:51 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * map.c: Editor function definitions
+ */
+#include <stdlib.h>
+#include "el.h"
+
+#define N_KEYS 256
+
+private void map_print_key(EditLine *, el_action_t *, const char *);
+private void map_print_some_keys(EditLine *, el_action_t *, int, int);
+private void map_print_all_keys(EditLine *);
+private void map_init_nls(EditLine *);
+private void map_init_meta(EditLine *);
+
+/* keymap tables ; should be N_KEYS*sizeof(KEYCMD) bytes long */
+
+
+private const el_action_t el_map_emacs[] = {
+ /* 0 */ EM_SET_MARK, /* ^@ */
+ /* 1 */ ED_MOVE_TO_BEG, /* ^A */
+ /* 2 */ ED_PREV_CHAR, /* ^B */
+ /* 3 */ ED_TTY_SIGINT, /* ^C */
+ /* 4 */ EM_DELETE_OR_LIST, /* ^D */
+ /* 5 */ ED_MOVE_TO_END, /* ^E */
+ /* 6 */ ED_NEXT_CHAR, /* ^F */
+ /* 7 */ ED_UNASSIGNED, /* ^G */
+ /* 8 */ ED_DELETE_PREV_CHAR, /* ^H */
+ /* 9 */ ED_UNASSIGNED, /* ^I */
+ /* 10 */ ED_NEWLINE, /* ^J */
+ /* 11 */ ED_KILL_LINE, /* ^K */
+ /* 12 */ ED_CLEAR_SCREEN, /* ^L */
+ /* 13 */ ED_NEWLINE, /* ^M */
+ /* 14 */ ED_NEXT_HISTORY, /* ^N */
+ /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */
+ /* 16 */ ED_PREV_HISTORY, /* ^P */
+ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */
+ /* 18 */ ED_REDISPLAY, /* ^R */
+ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */
+ /* 20 */ ED_TRANSPOSE_CHARS, /* ^T */
+ /* 21 */ EM_KILL_LINE, /* ^U */
+ /* 22 */ ED_QUOTED_INSERT, /* ^V */
+ /* 23 */ EM_KILL_REGION, /* ^W */
+ /* 24 */ ED_SEQUENCE_LEAD_IN, /* ^X */
+ /* 25 */ EM_YANK, /* ^Y */
+ /* 26 */ ED_TTY_SIGTSTP, /* ^Z */
+ /* 27 */ EM_META_NEXT, /* ^[ */
+ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */
+ /* 29 */ ED_TTY_DSUSP, /* ^] */
+ /* 30 */ ED_UNASSIGNED, /* ^^ */
+ /* 31 */ ED_UNASSIGNED, /* ^_ */
+ /* 32 */ ED_INSERT, /* SPACE */
+ /* 33 */ ED_INSERT, /* ! */
+ /* 34 */ ED_INSERT, /* " */
+ /* 35 */ ED_INSERT, /* # */
+ /* 36 */ ED_INSERT, /* $ */
+ /* 37 */ ED_INSERT, /* % */
+ /* 38 */ ED_INSERT, /* & */
+ /* 39 */ ED_INSERT, /* ' */
+ /* 40 */ ED_INSERT, /* ( */
+ /* 41 */ ED_INSERT, /* ) */
+ /* 42 */ ED_INSERT, /* * */
+ /* 43 */ ED_INSERT, /* + */
+ /* 44 */ ED_INSERT, /* , */
+ /* 45 */ ED_INSERT, /* - */
+ /* 46 */ ED_INSERT, /* . */
+ /* 47 */ ED_INSERT, /* / */
+ /* 48 */ ED_DIGIT, /* 0 */
+ /* 49 */ ED_DIGIT, /* 1 */
+ /* 50 */ ED_DIGIT, /* 2 */
+ /* 51 */ ED_DIGIT, /* 3 */
+ /* 52 */ ED_DIGIT, /* 4 */
+ /* 53 */ ED_DIGIT, /* 5 */
+ /* 54 */ ED_DIGIT, /* 6 */
+ /* 55 */ ED_DIGIT, /* 7 */
+ /* 56 */ ED_DIGIT, /* 8 */
+ /* 57 */ ED_DIGIT, /* 9 */
+ /* 58 */ ED_INSERT, /* : */
+ /* 59 */ ED_INSERT, /* ; */
+ /* 60 */ ED_INSERT, /* < */
+ /* 61 */ ED_INSERT, /* = */
+ /* 62 */ ED_INSERT, /* > */
+ /* 63 */ ED_INSERT, /* ? */
+ /* 64 */ ED_INSERT, /* @ */
+ /* 65 */ ED_INSERT, /* A */
+ /* 66 */ ED_INSERT, /* B */
+ /* 67 */ ED_INSERT, /* C */
+ /* 68 */ ED_INSERT, /* D */
+ /* 69 */ ED_INSERT, /* E */
+ /* 70 */ ED_INSERT, /* F */
+ /* 71 */ ED_INSERT, /* G */
+ /* 72 */ ED_INSERT, /* H */
+ /* 73 */ ED_INSERT, /* I */
+ /* 74 */ ED_INSERT, /* J */
+ /* 75 */ ED_INSERT, /* K */
+ /* 76 */ ED_INSERT, /* L */
+ /* 77 */ ED_INSERT, /* M */
+ /* 78 */ ED_INSERT, /* N */
+ /* 79 */ ED_INSERT, /* O */
+ /* 80 */ ED_INSERT, /* P */
+ /* 81 */ ED_INSERT, /* Q */
+ /* 82 */ ED_INSERT, /* R */
+ /* 83 */ ED_INSERT, /* S */
+ /* 84 */ ED_INSERT, /* T */
+ /* 85 */ ED_INSERT, /* U */
+ /* 86 */ ED_INSERT, /* V */
+ /* 87 */ ED_INSERT, /* W */
+ /* 88 */ ED_INSERT, /* X */
+ /* 89 */ ED_INSERT, /* Y */
+ /* 90 */ ED_INSERT, /* Z */
+ /* 91 */ ED_INSERT, /* [ */
+ /* 92 */ ED_INSERT, /* \ */
+ /* 93 */ ED_INSERT, /* ] */
+ /* 94 */ ED_INSERT, /* ^ */
+ /* 95 */ ED_INSERT, /* _ */
+ /* 96 */ ED_INSERT, /* ` */
+ /* 97 */ ED_INSERT, /* a */
+ /* 98 */ ED_INSERT, /* b */
+ /* 99 */ ED_INSERT, /* c */
+ /* 100 */ ED_INSERT, /* d */
+ /* 101 */ ED_INSERT, /* e */
+ /* 102 */ ED_INSERT, /* f */
+ /* 103 */ ED_INSERT, /* g */
+ /* 104 */ ED_INSERT, /* h */
+ /* 105 */ ED_INSERT, /* i */
+ /* 106 */ ED_INSERT, /* j */
+ /* 107 */ ED_INSERT, /* k */
+ /* 108 */ ED_INSERT, /* l */
+ /* 109 */ ED_INSERT, /* m */
+ /* 110 */ ED_INSERT, /* n */
+ /* 111 */ ED_INSERT, /* o */
+ /* 112 */ ED_INSERT, /* p */
+ /* 113 */ ED_INSERT, /* q */
+ /* 114 */ ED_INSERT, /* r */
+ /* 115 */ ED_INSERT, /* s */
+ /* 116 */ ED_INSERT, /* t */
+ /* 117 */ ED_INSERT, /* u */
+ /* 118 */ ED_INSERT, /* v */
+ /* 119 */ ED_INSERT, /* w */
+ /* 120 */ ED_INSERT, /* x */
+ /* 121 */ ED_INSERT, /* y */
+ /* 122 */ ED_INSERT, /* z */
+ /* 123 */ ED_INSERT, /* { */
+ /* 124 */ ED_INSERT, /* | */
+ /* 125 */ ED_INSERT, /* } */
+ /* 126 */ ED_INSERT, /* ~ */
+ /* 127 */ ED_DELETE_PREV_CHAR, /* ^? */
+ /* 128 */ ED_UNASSIGNED, /* M-^@ */
+ /* 129 */ ED_UNASSIGNED, /* M-^A */
+ /* 130 */ ED_UNASSIGNED, /* M-^B */
+ /* 131 */ ED_UNASSIGNED, /* M-^C */
+ /* 132 */ ED_UNASSIGNED, /* M-^D */
+ /* 133 */ ED_UNASSIGNED, /* M-^E */
+ /* 134 */ ED_UNASSIGNED, /* M-^F */
+ /* 135 */ ED_UNASSIGNED, /* M-^G */
+ /* 136 */ ED_DELETE_PREV_WORD, /* M-^H */
+ /* 137 */ ED_UNASSIGNED, /* M-^I */
+ /* 138 */ ED_UNASSIGNED, /* M-^J */
+ /* 139 */ ED_UNASSIGNED, /* M-^K */
+ /* 140 */ ED_CLEAR_SCREEN, /* M-^L */
+ /* 141 */ ED_UNASSIGNED, /* M-^M */
+ /* 142 */ ED_UNASSIGNED, /* M-^N */
+ /* 143 */ ED_UNASSIGNED, /* M-^O */
+ /* 144 */ ED_UNASSIGNED, /* M-^P */
+ /* 145 */ ED_UNASSIGNED, /* M-^Q */
+ /* 146 */ ED_UNASSIGNED, /* M-^R */
+ /* 147 */ ED_UNASSIGNED, /* M-^S */
+ /* 148 */ ED_UNASSIGNED, /* M-^T */
+ /* 149 */ ED_UNASSIGNED, /* M-^U */
+ /* 150 */ ED_UNASSIGNED, /* M-^V */
+ /* 151 */ ED_UNASSIGNED, /* M-^W */
+ /* 152 */ ED_UNASSIGNED, /* M-^X */
+ /* 153 */ ED_UNASSIGNED, /* M-^Y */
+ /* 154 */ ED_UNASSIGNED, /* M-^Z */
+ /* 155 */ ED_UNASSIGNED, /* M-^[ */
+ /* 156 */ ED_UNASSIGNED, /* M-^\ */
+ /* 157 */ ED_UNASSIGNED, /* M-^] */
+ /* 158 */ ED_UNASSIGNED, /* M-^^ */
+ /* 159 */ EM_COPY_PREV_WORD, /* M-^_ */
+ /* 160 */ ED_UNASSIGNED, /* M-SPACE */
+ /* 161 */ ED_UNASSIGNED, /* M-! */
+ /* 162 */ ED_UNASSIGNED, /* M-" */
+ /* 163 */ ED_UNASSIGNED, /* M-# */
+ /* 164 */ ED_UNASSIGNED, /* M-$ */
+ /* 165 */ ED_UNASSIGNED, /* M-% */
+ /* 166 */ ED_UNASSIGNED, /* M-& */
+ /* 167 */ ED_UNASSIGNED, /* M-' */
+ /* 168 */ ED_UNASSIGNED, /* M-( */
+ /* 169 */ ED_UNASSIGNED, /* M-) */
+ /* 170 */ ED_UNASSIGNED, /* M-* */
+ /* 171 */ ED_UNASSIGNED, /* M-+ */
+ /* 172 */ ED_UNASSIGNED, /* M-, */
+ /* 173 */ ED_UNASSIGNED, /* M-- */
+ /* 174 */ ED_UNASSIGNED, /* M-. */
+ /* 175 */ ED_UNASSIGNED, /* M-/ */
+ /* 176 */ ED_ARGUMENT_DIGIT, /* M-0 */
+ /* 177 */ ED_ARGUMENT_DIGIT, /* M-1 */
+ /* 178 */ ED_ARGUMENT_DIGIT, /* M-2 */
+ /* 179 */ ED_ARGUMENT_DIGIT, /* M-3 */
+ /* 180 */ ED_ARGUMENT_DIGIT, /* M-4 */
+ /* 181 */ ED_ARGUMENT_DIGIT, /* M-5 */
+ /* 182 */ ED_ARGUMENT_DIGIT, /* M-6 */
+ /* 183 */ ED_ARGUMENT_DIGIT, /* M-7 */
+ /* 184 */ ED_ARGUMENT_DIGIT, /* M-8 */
+ /* 185 */ ED_ARGUMENT_DIGIT, /* M-9 */
+ /* 186 */ ED_UNASSIGNED, /* M-: */
+ /* 187 */ ED_UNASSIGNED, /* M-; */
+ /* 188 */ ED_UNASSIGNED, /* M-< */
+ /* 189 */ ED_UNASSIGNED, /* M-= */
+ /* 190 */ ED_UNASSIGNED, /* M-> */
+ /* 191 */ ED_UNASSIGNED, /* M-? */
+ /* 192 */ ED_UNASSIGNED, /* M-@ */
+ /* 193 */ ED_UNASSIGNED, /* M-A */
+ /* 194 */ ED_PREV_WORD, /* M-B */
+ /* 195 */ EM_CAPITOL_CASE, /* M-C */
+ /* 196 */ EM_DELETE_NEXT_WORD, /* M-D */
+ /* 197 */ ED_UNASSIGNED, /* M-E */
+ /* 198 */ EM_NEXT_WORD, /* M-F */
+ /* 199 */ ED_UNASSIGNED, /* M-G */
+ /* 200 */ ED_UNASSIGNED, /* M-H */
+ /* 201 */ ED_UNASSIGNED, /* M-I */
+ /* 202 */ ED_UNASSIGNED, /* M-J */
+ /* 203 */ ED_UNASSIGNED, /* M-K */
+ /* 204 */ EM_LOWER_CASE, /* M-L */
+ /* 205 */ ED_UNASSIGNED, /* M-M */
+ /* 206 */ ED_SEARCH_NEXT_HISTORY, /* M-N */
+ /* 207 */ ED_SEQUENCE_LEAD_IN, /* M-O */
+ /* 208 */ ED_SEARCH_PREV_HISTORY, /* M-P */
+ /* 209 */ ED_UNASSIGNED, /* M-Q */
+ /* 210 */ ED_UNASSIGNED, /* M-R */
+ /* 211 */ ED_UNASSIGNED, /* M-S */
+ /* 212 */ ED_UNASSIGNED, /* M-T */
+ /* 213 */ EM_UPPER_CASE, /* M-U */
+ /* 214 */ ED_UNASSIGNED, /* M-V */
+ /* 215 */ EM_COPY_REGION, /* M-W */
+ /* 216 */ ED_COMMAND, /* M-X */
+ /* 217 */ ED_UNASSIGNED, /* M-Y */
+ /* 218 */ ED_UNASSIGNED, /* M-Z */
+ /* 219 */ ED_SEQUENCE_LEAD_IN, /* M-[ */
+ /* 220 */ ED_UNASSIGNED, /* M-\ */
+ /* 221 */ ED_UNASSIGNED, /* M-] */
+ /* 222 */ ED_UNASSIGNED, /* M-^ */
+ /* 223 */ ED_UNASSIGNED, /* M-_ */
+ /* 223 */ ED_UNASSIGNED, /* M-` */
+ /* 224 */ ED_UNASSIGNED, /* M-a */
+ /* 225 */ ED_PREV_WORD, /* M-b */
+ /* 226 */ EM_CAPITOL_CASE, /* M-c */
+ /* 227 */ EM_DELETE_NEXT_WORD, /* M-d */
+ /* 228 */ ED_UNASSIGNED, /* M-e */
+ /* 229 */ EM_NEXT_WORD, /* M-f */
+ /* 230 */ ED_UNASSIGNED, /* M-g */
+ /* 231 */ ED_UNASSIGNED, /* M-h */
+ /* 232 */ ED_UNASSIGNED, /* M-i */
+ /* 233 */ ED_UNASSIGNED, /* M-j */
+ /* 234 */ ED_UNASSIGNED, /* M-k */
+ /* 235 */ EM_LOWER_CASE, /* M-l */
+ /* 236 */ ED_UNASSIGNED, /* M-m */
+ /* 237 */ ED_SEARCH_NEXT_HISTORY, /* M-n */
+ /* 238 */ ED_UNASSIGNED, /* M-o */
+ /* 239 */ ED_SEARCH_PREV_HISTORY, /* M-p */
+ /* 240 */ ED_UNASSIGNED, /* M-q */
+ /* 241 */ ED_UNASSIGNED, /* M-r */
+ /* 242 */ ED_UNASSIGNED, /* M-s */
+ /* 243 */ ED_UNASSIGNED, /* M-t */
+ /* 244 */ EM_UPPER_CASE, /* M-u */
+ /* 245 */ ED_UNASSIGNED, /* M-v */
+ /* 246 */ EM_COPY_REGION, /* M-w */
+ /* 247 */ ED_COMMAND, /* M-x */
+ /* 248 */ ED_UNASSIGNED, /* M-y */
+ /* 249 */ ED_UNASSIGNED, /* M-z */
+ /* 250 */ ED_UNASSIGNED, /* M-{ */
+ /* 251 */ ED_UNASSIGNED, /* M-| */
+ /* 252 */ ED_UNASSIGNED, /* M-} */
+ /* 253 */ ED_UNASSIGNED, /* M-~ */
+ /* 254 */ ED_DELETE_PREV_WORD /* M-^? */
+ /* 255 */
+};
+
+
+/*
+ * keymap table for vi. Each index into above tbl; should be
+ * N_KEYS entries long. Vi mode uses a sticky-extend to do command mode:
+ * insert mode characters are in the normal keymap, and command mode
+ * in the extended keymap.
+ */
+private const el_action_t el_map_vi_insert[] = {
+#ifdef KSHVI
+ /* 0 */ ED_UNASSIGNED, /* ^@ */
+ /* 1 */ ED_INSERT, /* ^A */
+ /* 2 */ ED_INSERT, /* ^B */
+ /* 3 */ ED_INSERT, /* ^C */
+ /* 4 */ VI_LIST_OR_EOF, /* ^D */
+ /* 5 */ ED_INSERT, /* ^E */
+ /* 6 */ ED_INSERT, /* ^F */
+ /* 7 */ ED_INSERT, /* ^G */
+ /* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */
+ /* 9 */ ED_INSERT, /* ^I */ /* Tab Key */
+ /* 10 */ ED_NEWLINE, /* ^J */
+ /* 11 */ ED_INSERT, /* ^K */
+ /* 12 */ ED_INSERT, /* ^L */
+ /* 13 */ ED_NEWLINE, /* ^M */
+ /* 14 */ ED_INSERT, /* ^N */
+ /* 15 */ ED_INSERT, /* ^O */
+ /* 16 */ ED_INSERT, /* ^P */
+ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */
+ /* 18 */ ED_INSERT, /* ^R */
+ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */
+ /* 20 */ ED_INSERT, /* ^T */
+ /* 21 */ VI_KILL_LINE_PREV, /* ^U */
+ /* 22 */ ED_QUOTED_INSERT, /* ^V */
+ /* 23 */ ED_DELETE_PREV_WORD, /* ^W */
+ /* ED_DELETE_PREV_WORD: Only until strt edit pos */
+ /* 24 */ ED_INSERT, /* ^X */
+ /* 25 */ ED_INSERT, /* ^Y */
+ /* 26 */ ED_INSERT, /* ^Z */
+ /* 27 */ VI_COMMAND_MODE, /* ^[ */ /* [ Esc ] key */
+ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */
+ /* 29 */ ED_INSERT, /* ^] */
+ /* 30 */ ED_INSERT, /* ^^ */
+ /* 31 */ ED_INSERT, /* ^_ */
+#else /* !KSHVI */
+ /*
+ * NOTE: These mappings do NOT Correspond well
+ * to the KSH VI editing assignments.
+ * On the other and they are convenient and
+ * many people have have gotten used to them.
+ */
+ /* 0 */ ED_UNASSIGNED, /* ^@ */
+ /* 1 */ ED_MOVE_TO_BEG, /* ^A */
+ /* 2 */ ED_PREV_CHAR, /* ^B */
+ /* 3 */ ED_TTY_SIGINT, /* ^C */
+ /* 4 */ VI_LIST_OR_EOF, /* ^D */
+ /* 5 */ ED_MOVE_TO_END, /* ^E */
+ /* 6 */ ED_NEXT_CHAR, /* ^F */
+ /* 7 */ ED_UNASSIGNED, /* ^G */
+ /* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */
+ /* 9 */ ED_UNASSIGNED, /* ^I */ /* Tab Key */
+ /* 10 */ ED_NEWLINE, /* ^J */
+ /* 11 */ ED_KILL_LINE, /* ^K */
+ /* 12 */ ED_CLEAR_SCREEN, /* ^L */
+ /* 13 */ ED_NEWLINE, /* ^M */
+ /* 14 */ ED_NEXT_HISTORY, /* ^N */
+ /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */
+ /* 16 */ ED_PREV_HISTORY, /* ^P */
+ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */
+ /* 18 */ ED_REDISPLAY, /* ^R */
+ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */
+ /* 20 */ ED_TRANSPOSE_CHARS, /* ^T */
+ /* 21 */ VI_KILL_LINE_PREV, /* ^U */
+ /* 22 */ ED_QUOTED_INSERT, /* ^V */
+ /* 23 */ ED_DELETE_PREV_WORD, /* ^W */
+ /* 24 */ ED_UNASSIGNED, /* ^X */
+ /* 25 */ ED_TTY_DSUSP, /* ^Y */
+ /* 26 */ ED_TTY_SIGTSTP, /* ^Z */
+ /* 27 */ VI_COMMAND_MODE, /* ^[ */
+ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */
+ /* 29 */ ED_UNASSIGNED, /* ^] */
+ /* 30 */ ED_UNASSIGNED, /* ^^ */
+ /* 31 */ ED_UNASSIGNED, /* ^_ */
+#endif /* KSHVI */
+ /* 32 */ ED_INSERT, /* SPACE */
+ /* 33 */ ED_INSERT, /* ! */
+ /* 34 */ ED_INSERT, /* " */
+ /* 35 */ ED_INSERT, /* # */
+ /* 36 */ ED_INSERT, /* $ */
+ /* 37 */ ED_INSERT, /* % */
+ /* 38 */ ED_INSERT, /* & */
+ /* 39 */ ED_INSERT, /* ' */
+ /* 40 */ ED_INSERT, /* ( */
+ /* 41 */ ED_INSERT, /* ) */
+ /* 42 */ ED_INSERT, /* * */
+ /* 43 */ ED_INSERT, /* + */
+ /* 44 */ ED_INSERT, /* , */
+ /* 45 */ ED_INSERT, /* - */
+ /* 46 */ ED_INSERT, /* . */
+ /* 47 */ ED_INSERT, /* / */
+ /* 48 */ ED_INSERT, /* 0 */
+ /* 49 */ ED_INSERT, /* 1 */
+ /* 50 */ ED_INSERT, /* 2 */
+ /* 51 */ ED_INSERT, /* 3 */
+ /* 52 */ ED_INSERT, /* 4 */
+ /* 53 */ ED_INSERT, /* 5 */
+ /* 54 */ ED_INSERT, /* 6 */
+ /* 55 */ ED_INSERT, /* 7 */
+ /* 56 */ ED_INSERT, /* 8 */
+ /* 57 */ ED_INSERT, /* 9 */
+ /* 58 */ ED_INSERT, /* : */
+ /* 59 */ ED_INSERT, /* ; */
+ /* 60 */ ED_INSERT, /* < */
+ /* 61 */ ED_INSERT, /* = */
+ /* 62 */ ED_INSERT, /* > */
+ /* 63 */ ED_INSERT, /* ? */
+ /* 64 */ ED_INSERT, /* @ */
+ /* 65 */ ED_INSERT, /* A */
+ /* 66 */ ED_INSERT, /* B */
+ /* 67 */ ED_INSERT, /* C */
+ /* 68 */ ED_INSERT, /* D */
+ /* 69 */ ED_INSERT, /* E */
+ /* 70 */ ED_INSERT, /* F */
+ /* 71 */ ED_INSERT, /* G */
+ /* 72 */ ED_INSERT, /* H */
+ /* 73 */ ED_INSERT, /* I */
+ /* 74 */ ED_INSERT, /* J */
+ /* 75 */ ED_INSERT, /* K */
+ /* 76 */ ED_INSERT, /* L */
+ /* 77 */ ED_INSERT, /* M */
+ /* 78 */ ED_INSERT, /* N */
+ /* 79 */ ED_INSERT, /* O */
+ /* 80 */ ED_INSERT, /* P */
+ /* 81 */ ED_INSERT, /* Q */
+ /* 82 */ ED_INSERT, /* R */
+ /* 83 */ ED_INSERT, /* S */
+ /* 84 */ ED_INSERT, /* T */
+ /* 85 */ ED_INSERT, /* U */
+ /* 86 */ ED_INSERT, /* V */
+ /* 87 */ ED_INSERT, /* W */
+ /* 88 */ ED_INSERT, /* X */
+ /* 89 */ ED_INSERT, /* Y */
+ /* 90 */ ED_INSERT, /* Z */
+ /* 91 */ ED_INSERT, /* [ */
+ /* 92 */ ED_INSERT, /* \ */
+ /* 93 */ ED_INSERT, /* ] */
+ /* 94 */ ED_INSERT, /* ^ */
+ /* 95 */ ED_INSERT, /* _ */
+ /* 96 */ ED_INSERT, /* ` */
+ /* 97 */ ED_INSERT, /* a */
+ /* 98 */ ED_INSERT, /* b */
+ /* 99 */ ED_INSERT, /* c */
+ /* 100 */ ED_INSERT, /* d */
+ /* 101 */ ED_INSERT, /* e */
+ /* 102 */ ED_INSERT, /* f */
+ /* 103 */ ED_INSERT, /* g */
+ /* 104 */ ED_INSERT, /* h */
+ /* 105 */ ED_INSERT, /* i */
+ /* 106 */ ED_INSERT, /* j */
+ /* 107 */ ED_INSERT, /* k */
+ /* 108 */ ED_INSERT, /* l */
+ /* 109 */ ED_INSERT, /* m */
+ /* 110 */ ED_INSERT, /* n */
+ /* 111 */ ED_INSERT, /* o */
+ /* 112 */ ED_INSERT, /* p */
+ /* 113 */ ED_INSERT, /* q */
+ /* 114 */ ED_INSERT, /* r */
+ /* 115 */ ED_INSERT, /* s */
+ /* 116 */ ED_INSERT, /* t */
+ /* 117 */ ED_INSERT, /* u */
+ /* 118 */ ED_INSERT, /* v */
+ /* 119 */ ED_INSERT, /* w */
+ /* 120 */ ED_INSERT, /* x */
+ /* 121 */ ED_INSERT, /* y */
+ /* 122 */ ED_INSERT, /* z */
+ /* 123 */ ED_INSERT, /* { */
+ /* 124 */ ED_INSERT, /* | */
+ /* 125 */ ED_INSERT, /* } */
+ /* 126 */ ED_INSERT, /* ~ */
+ /* 127 */ VI_DELETE_PREV_CHAR, /* ^? */
+ /* 128 */ ED_INSERT, /* M-^@ */
+ /* 129 */ ED_INSERT, /* M-^A */
+ /* 130 */ ED_INSERT, /* M-^B */
+ /* 131 */ ED_INSERT, /* M-^C */
+ /* 132 */ ED_INSERT, /* M-^D */
+ /* 133 */ ED_INSERT, /* M-^E */
+ /* 134 */ ED_INSERT, /* M-^F */
+ /* 135 */ ED_INSERT, /* M-^G */
+ /* 136 */ ED_INSERT, /* M-^H */
+ /* 137 */ ED_INSERT, /* M-^I */
+ /* 138 */ ED_INSERT, /* M-^J */
+ /* 139 */ ED_INSERT, /* M-^K */
+ /* 140 */ ED_INSERT, /* M-^L */
+ /* 141 */ ED_INSERT, /* M-^M */
+ /* 142 */ ED_INSERT, /* M-^N */
+ /* 143 */ ED_INSERT, /* M-^O */
+ /* 144 */ ED_INSERT, /* M-^P */
+ /* 145 */ ED_INSERT, /* M-^Q */
+ /* 146 */ ED_INSERT, /* M-^R */
+ /* 147 */ ED_INSERT, /* M-^S */
+ /* 148 */ ED_INSERT, /* M-^T */
+ /* 149 */ ED_INSERT, /* M-^U */
+ /* 150 */ ED_INSERT, /* M-^V */
+ /* 151 */ ED_INSERT, /* M-^W */
+ /* 152 */ ED_INSERT, /* M-^X */
+ /* 153 */ ED_INSERT, /* M-^Y */
+ /* 154 */ ED_INSERT, /* M-^Z */
+ /* 155 */ ED_INSERT, /* M-^[ */
+ /* 156 */ ED_INSERT, /* M-^\ */
+ /* 157 */ ED_INSERT, /* M-^] */
+ /* 158 */ ED_INSERT, /* M-^^ */
+ /* 159 */ ED_INSERT, /* M-^_ */
+ /* 160 */ ED_INSERT, /* M-SPACE */
+ /* 161 */ ED_INSERT, /* M-! */
+ /* 162 */ ED_INSERT, /* M-" */
+ /* 163 */ ED_INSERT, /* M-# */
+ /* 164 */ ED_INSERT, /* M-$ */
+ /* 165 */ ED_INSERT, /* M-% */
+ /* 166 */ ED_INSERT, /* M-& */
+ /* 167 */ ED_INSERT, /* M-' */
+ /* 168 */ ED_INSERT, /* M-( */
+ /* 169 */ ED_INSERT, /* M-) */
+ /* 170 */ ED_INSERT, /* M-* */
+ /* 171 */ ED_INSERT, /* M-+ */
+ /* 172 */ ED_INSERT, /* M-, */
+ /* 173 */ ED_INSERT, /* M-- */
+ /* 174 */ ED_INSERT, /* M-. */
+ /* 175 */ ED_INSERT, /* M-/ */
+ /* 176 */ ED_INSERT, /* M-0 */
+ /* 177 */ ED_INSERT, /* M-1 */
+ /* 178 */ ED_INSERT, /* M-2 */
+ /* 179 */ ED_INSERT, /* M-3 */
+ /* 180 */ ED_INSERT, /* M-4 */
+ /* 181 */ ED_INSERT, /* M-5 */
+ /* 182 */ ED_INSERT, /* M-6 */
+ /* 183 */ ED_INSERT, /* M-7 */
+ /* 184 */ ED_INSERT, /* M-8 */
+ /* 185 */ ED_INSERT, /* M-9 */
+ /* 186 */ ED_INSERT, /* M-: */
+ /* 187 */ ED_INSERT, /* M-; */
+ /* 188 */ ED_INSERT, /* M-< */
+ /* 189 */ ED_INSERT, /* M-= */
+ /* 190 */ ED_INSERT, /* M-> */
+ /* 191 */ ED_INSERT, /* M-? */
+ /* 192 */ ED_INSERT, /* M-@ */
+ /* 193 */ ED_INSERT, /* M-A */
+ /* 194 */ ED_INSERT, /* M-B */
+ /* 195 */ ED_INSERT, /* M-C */
+ /* 196 */ ED_INSERT, /* M-D */
+ /* 197 */ ED_INSERT, /* M-E */
+ /* 198 */ ED_INSERT, /* M-F */
+ /* 199 */ ED_INSERT, /* M-G */
+ /* 200 */ ED_INSERT, /* M-H */
+ /* 201 */ ED_INSERT, /* M-I */
+ /* 202 */ ED_INSERT, /* M-J */
+ /* 203 */ ED_INSERT, /* M-K */
+ /* 204 */ ED_INSERT, /* M-L */
+ /* 205 */ ED_INSERT, /* M-M */
+ /* 206 */ ED_INSERT, /* M-N */
+ /* 207 */ ED_INSERT, /* M-O */
+ /* 208 */ ED_INSERT, /* M-P */
+ /* 209 */ ED_INSERT, /* M-Q */
+ /* 210 */ ED_INSERT, /* M-R */
+ /* 211 */ ED_INSERT, /* M-S */
+ /* 212 */ ED_INSERT, /* M-T */
+ /* 213 */ ED_INSERT, /* M-U */
+ /* 214 */ ED_INSERT, /* M-V */
+ /* 215 */ ED_INSERT, /* M-W */
+ /* 216 */ ED_INSERT, /* M-X */
+ /* 217 */ ED_INSERT, /* M-Y */
+ /* 218 */ ED_INSERT, /* M-Z */
+ /* 219 */ ED_INSERT, /* M-[ */
+ /* 220 */ ED_INSERT, /* M-\ */
+ /* 221 */ ED_INSERT, /* M-] */
+ /* 222 */ ED_INSERT, /* M-^ */
+ /* 223 */ ED_INSERT, /* M-_ */
+ /* 224 */ ED_INSERT, /* M-` */
+ /* 225 */ ED_INSERT, /* M-a */
+ /* 226 */ ED_INSERT, /* M-b */
+ /* 227 */ ED_INSERT, /* M-c */
+ /* 228 */ ED_INSERT, /* M-d */
+ /* 229 */ ED_INSERT, /* M-e */
+ /* 230 */ ED_INSERT, /* M-f */
+ /* 231 */ ED_INSERT, /* M-g */
+ /* 232 */ ED_INSERT, /* M-h */
+ /* 233 */ ED_INSERT, /* M-i */
+ /* 234 */ ED_INSERT, /* M-j */
+ /* 235 */ ED_INSERT, /* M-k */
+ /* 236 */ ED_INSERT, /* M-l */
+ /* 237 */ ED_INSERT, /* M-m */
+ /* 238 */ ED_INSERT, /* M-n */
+ /* 239 */ ED_INSERT, /* M-o */
+ /* 240 */ ED_INSERT, /* M-p */
+ /* 241 */ ED_INSERT, /* M-q */
+ /* 242 */ ED_INSERT, /* M-r */
+ /* 243 */ ED_INSERT, /* M-s */
+ /* 244 */ ED_INSERT, /* M-t */
+ /* 245 */ ED_INSERT, /* M-u */
+ /* 246 */ ED_INSERT, /* M-v */
+ /* 247 */ ED_INSERT, /* M-w */
+ /* 248 */ ED_INSERT, /* M-x */
+ /* 249 */ ED_INSERT, /* M-y */
+ /* 250 */ ED_INSERT, /* M-z */
+ /* 251 */ ED_INSERT, /* M-{ */
+ /* 252 */ ED_INSERT, /* M-| */
+ /* 253 */ ED_INSERT, /* M-} */
+ /* 254 */ ED_INSERT, /* M-~ */
+ /* 255 */ ED_INSERT /* M-^? */
+};
+
+private const el_action_t el_map_vi_command[] = {
+ /* 0 */ ED_UNASSIGNED, /* ^@ */
+ /* 1 */ ED_MOVE_TO_BEG, /* ^A */
+ /* 2 */ ED_UNASSIGNED, /* ^B */
+ /* 3 */ ED_TTY_SIGINT, /* ^C */
+ /* 4 */ ED_UNASSIGNED, /* ^D */
+ /* 5 */ ED_MOVE_TO_END, /* ^E */
+ /* 6 */ ED_UNASSIGNED, /* ^F */
+ /* 7 */ ED_UNASSIGNED, /* ^G */
+ /* 8 */ ED_DELETE_PREV_CHAR, /* ^H */
+ /* 9 */ ED_UNASSIGNED, /* ^I */
+ /* 10 */ ED_NEWLINE, /* ^J */
+ /* 11 */ ED_KILL_LINE, /* ^K */
+ /* 12 */ ED_CLEAR_SCREEN, /* ^L */
+ /* 13 */ ED_NEWLINE, /* ^M */
+ /* 14 */ ED_NEXT_HISTORY, /* ^N */
+ /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */
+ /* 16 */ ED_PREV_HISTORY, /* ^P */
+ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */
+ /* 18 */ ED_REDISPLAY, /* ^R */
+ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */
+ /* 20 */ ED_UNASSIGNED, /* ^T */
+ /* 21 */ VI_KILL_LINE_PREV, /* ^U */
+ /* 22 */ ED_UNASSIGNED, /* ^V */
+ /* 23 */ ED_DELETE_PREV_WORD, /* ^W */
+ /* 24 */ ED_UNASSIGNED, /* ^X */
+ /* 25 */ ED_UNASSIGNED, /* ^Y */
+ /* 26 */ ED_UNASSIGNED, /* ^Z */
+ /* 27 */ EM_META_NEXT, /* ^[ */
+ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */
+ /* 29 */ ED_UNASSIGNED, /* ^] */
+ /* 30 */ ED_UNASSIGNED, /* ^^ */
+ /* 31 */ ED_UNASSIGNED, /* ^_ */
+ /* 32 */ ED_NEXT_CHAR, /* SPACE */
+ /* 33 */ ED_UNASSIGNED, /* ! */
+ /* 34 */ ED_UNASSIGNED, /* " */
+ /* 35 */ VI_COMMENT_OUT, /* # */
+ /* 36 */ ED_MOVE_TO_END, /* $ */
+ /* 37 */ VI_MATCH, /* % */
+ /* 38 */ ED_UNASSIGNED, /* & */
+ /* 39 */ ED_UNASSIGNED, /* ' */
+ /* 40 */ ED_UNASSIGNED, /* ( */
+ /* 41 */ ED_UNASSIGNED, /* ) */
+ /* 42 */ ED_UNASSIGNED, /* * */
+ /* 43 */ ED_NEXT_HISTORY, /* + */
+ /* 44 */ VI_REPEAT_PREV_CHAR, /* , */
+ /* 45 */ ED_PREV_HISTORY, /* - */
+ /* 46 */ VI_REDO, /* . */
+ /* 47 */ VI_SEARCH_PREV, /* / */
+ /* 48 */ VI_ZERO, /* 0 */
+ /* 49 */ ED_ARGUMENT_DIGIT, /* 1 */
+ /* 50 */ ED_ARGUMENT_DIGIT, /* 2 */
+ /* 51 */ ED_ARGUMENT_DIGIT, /* 3 */
+ /* 52 */ ED_ARGUMENT_DIGIT, /* 4 */
+ /* 53 */ ED_ARGUMENT_DIGIT, /* 5 */
+ /* 54 */ ED_ARGUMENT_DIGIT, /* 6 */
+ /* 55 */ ED_ARGUMENT_DIGIT, /* 7 */
+ /* 56 */ ED_ARGUMENT_DIGIT, /* 8 */
+ /* 57 */ ED_ARGUMENT_DIGIT, /* 9 */
+ /* 58 */ ED_COMMAND, /* : */
+ /* 59 */ VI_REPEAT_NEXT_CHAR, /* ; */
+ /* 60 */ ED_UNASSIGNED, /* < */
+ /* 61 */ ED_UNASSIGNED, /* = */
+ /* 62 */ ED_UNASSIGNED, /* > */
+ /* 63 */ VI_SEARCH_NEXT, /* ? */
+ /* 64 */ VI_ALIAS, /* @ */
+ /* 65 */ VI_ADD_AT_EOL, /* A */
+ /* 66 */ VI_PREV_BIG_WORD, /* B */
+ /* 67 */ VI_CHANGE_TO_EOL, /* C */
+ /* 68 */ ED_KILL_LINE, /* D */
+ /* 69 */ VI_END_BIG_WORD, /* E */
+ /* 70 */ VI_PREV_CHAR, /* F */
+ /* 71 */ VI_TO_HISTORY_LINE, /* G */
+ /* 72 */ ED_UNASSIGNED, /* H */
+ /* 73 */ VI_INSERT_AT_BOL, /* I */
+ /* 74 */ ED_SEARCH_NEXT_HISTORY, /* J */
+ /* 75 */ ED_SEARCH_PREV_HISTORY, /* K */
+ /* 76 */ ED_UNASSIGNED, /* L */
+ /* 77 */ ED_UNASSIGNED, /* M */
+ /* 78 */ VI_REPEAT_SEARCH_PREV, /* N */
+ /* 79 */ ED_SEQUENCE_LEAD_IN, /* O */
+ /* 80 */ VI_PASTE_PREV, /* P */
+ /* 81 */ ED_UNASSIGNED, /* Q */
+ /* 82 */ VI_REPLACE_MODE, /* R */
+ /* 83 */ VI_SUBSTITUTE_LINE, /* S */
+ /* 84 */ VI_TO_PREV_CHAR, /* T */
+ /* 85 */ VI_UNDO_LINE, /* U */
+ /* 86 */ ED_UNASSIGNED, /* V */
+ /* 87 */ VI_NEXT_BIG_WORD, /* W */
+ /* 88 */ ED_DELETE_PREV_CHAR, /* X */
+ /* 89 */ VI_YANK_END, /* Y */
+ /* 90 */ ED_UNASSIGNED, /* Z */
+ /* 91 */ ED_SEQUENCE_LEAD_IN, /* [ */
+ /* 92 */ ED_UNASSIGNED, /* \ */
+ /* 93 */ ED_UNASSIGNED, /* ] */
+ /* 94 */ ED_MOVE_TO_BEG, /* ^ */
+ /* 95 */ VI_HISTORY_WORD, /* _ */
+ /* 96 */ ED_UNASSIGNED, /* ` */
+ /* 97 */ VI_ADD, /* a */
+ /* 98 */ VI_PREV_WORD, /* b */
+ /* 99 */ VI_CHANGE_META, /* c */
+ /* 100 */ VI_DELETE_META, /* d */
+ /* 101 */ VI_END_WORD, /* e */
+ /* 102 */ VI_NEXT_CHAR, /* f */
+ /* 103 */ ED_UNASSIGNED, /* g */
+ /* 104 */ ED_PREV_CHAR, /* h */
+ /* 105 */ VI_INSERT, /* i */
+ /* 106 */ ED_NEXT_HISTORY, /* j */
+ /* 107 */ ED_PREV_HISTORY, /* k */
+ /* 108 */ ED_NEXT_CHAR, /* l */
+ /* 109 */ ED_UNASSIGNED, /* m */
+ /* 110 */ VI_REPEAT_SEARCH_NEXT, /* n */
+ /* 111 */ ED_UNASSIGNED, /* o */
+ /* 112 */ VI_PASTE_NEXT, /* p */
+ /* 113 */ ED_UNASSIGNED, /* q */
+ /* 114 */ VI_REPLACE_CHAR, /* r */
+ /* 115 */ VI_SUBSTITUTE_CHAR, /* s */
+ /* 116 */ VI_TO_NEXT_CHAR, /* t */
+ /* 117 */ VI_UNDO, /* u */
+ /* 118 */ VI_HISTEDIT, /* v */
+ /* 119 */ VI_NEXT_WORD, /* w */
+ /* 120 */ ED_DELETE_NEXT_CHAR, /* x */
+ /* 121 */ VI_YANK, /* y */
+ /* 122 */ ED_UNASSIGNED, /* z */
+ /* 123 */ ED_UNASSIGNED, /* { */
+ /* 124 */ VI_TO_COLUMN, /* | */
+ /* 125 */ ED_UNASSIGNED, /* } */
+ /* 126 */ VI_CHANGE_CASE, /* ~ */
+ /* 127 */ ED_DELETE_PREV_CHAR, /* ^? */
+ /* 128 */ ED_UNASSIGNED, /* M-^@ */
+ /* 129 */ ED_UNASSIGNED, /* M-^A */
+ /* 130 */ ED_UNASSIGNED, /* M-^B */
+ /* 131 */ ED_UNASSIGNED, /* M-^C */
+ /* 132 */ ED_UNASSIGNED, /* M-^D */
+ /* 133 */ ED_UNASSIGNED, /* M-^E */
+ /* 134 */ ED_UNASSIGNED, /* M-^F */
+ /* 135 */ ED_UNASSIGNED, /* M-^G */
+ /* 136 */ ED_UNASSIGNED, /* M-^H */
+ /* 137 */ ED_UNASSIGNED, /* M-^I */
+ /* 138 */ ED_UNASSIGNED, /* M-^J */
+ /* 139 */ ED_UNASSIGNED, /* M-^K */
+ /* 140 */ ED_UNASSIGNED, /* M-^L */
+ /* 141 */ ED_UNASSIGNED, /* M-^M */
+ /* 142 */ ED_UNASSIGNED, /* M-^N */
+ /* 143 */ ED_UNASSIGNED, /* M-^O */
+ /* 144 */ ED_UNASSIGNED, /* M-^P */
+ /* 145 */ ED_UNASSIGNED, /* M-^Q */
+ /* 146 */ ED_UNASSIGNED, /* M-^R */
+ /* 147 */ ED_UNASSIGNED, /* M-^S */
+ /* 148 */ ED_UNASSIGNED, /* M-^T */
+ /* 149 */ ED_UNASSIGNED, /* M-^U */
+ /* 150 */ ED_UNASSIGNED, /* M-^V */
+ /* 151 */ ED_UNASSIGNED, /* M-^W */
+ /* 152 */ ED_UNASSIGNED, /* M-^X */
+ /* 153 */ ED_UNASSIGNED, /* M-^Y */
+ /* 154 */ ED_UNASSIGNED, /* M-^Z */
+ /* 155 */ ED_UNASSIGNED, /* M-^[ */
+ /* 156 */ ED_UNASSIGNED, /* M-^\ */
+ /* 157 */ ED_UNASSIGNED, /* M-^] */
+ /* 158 */ ED_UNASSIGNED, /* M-^^ */
+ /* 159 */ ED_UNASSIGNED, /* M-^_ */
+ /* 160 */ ED_UNASSIGNED, /* M-SPACE */
+ /* 161 */ ED_UNASSIGNED, /* M-! */
+ /* 162 */ ED_UNASSIGNED, /* M-" */
+ /* 163 */ ED_UNASSIGNED, /* M-# */
+ /* 164 */ ED_UNASSIGNED, /* M-$ */
+ /* 165 */ ED_UNASSIGNED, /* M-% */
+ /* 166 */ ED_UNASSIGNED, /* M-& */
+ /* 167 */ ED_UNASSIGNED, /* M-' */
+ /* 168 */ ED_UNASSIGNED, /* M-( */
+ /* 169 */ ED_UNASSIGNED, /* M-) */
+ /* 170 */ ED_UNASSIGNED, /* M-* */
+ /* 171 */ ED_UNASSIGNED, /* M-+ */
+ /* 172 */ ED_UNASSIGNED, /* M-, */
+ /* 173 */ ED_UNASSIGNED, /* M-- */
+ /* 174 */ ED_UNASSIGNED, /* M-. */
+ /* 175 */ ED_UNASSIGNED, /* M-/ */
+ /* 176 */ ED_UNASSIGNED, /* M-0 */
+ /* 177 */ ED_UNASSIGNED, /* M-1 */
+ /* 178 */ ED_UNASSIGNED, /* M-2 */
+ /* 179 */ ED_UNASSIGNED, /* M-3 */
+ /* 180 */ ED_UNASSIGNED, /* M-4 */
+ /* 181 */ ED_UNASSIGNED, /* M-5 */
+ /* 182 */ ED_UNASSIGNED, /* M-6 */
+ /* 183 */ ED_UNASSIGNED, /* M-7 */
+ /* 184 */ ED_UNASSIGNED, /* M-8 */
+ /* 185 */ ED_UNASSIGNED, /* M-9 */
+ /* 186 */ ED_UNASSIGNED, /* M-: */
+ /* 187 */ ED_UNASSIGNED, /* M-; */
+ /* 188 */ ED_UNASSIGNED, /* M-< */
+ /* 189 */ ED_UNASSIGNED, /* M-= */
+ /* 190 */ ED_UNASSIGNED, /* M-> */
+ /* 191 */ ED_UNASSIGNED, /* M-? */
+ /* 192 */ ED_UNASSIGNED, /* M-@ */
+ /* 193 */ ED_UNASSIGNED, /* M-A */
+ /* 194 */ ED_UNASSIGNED, /* M-B */
+ /* 195 */ ED_UNASSIGNED, /* M-C */
+ /* 196 */ ED_UNASSIGNED, /* M-D */
+ /* 197 */ ED_UNASSIGNED, /* M-E */
+ /* 198 */ ED_UNASSIGNED, /* M-F */
+ /* 199 */ ED_UNASSIGNED, /* M-G */
+ /* 200 */ ED_UNASSIGNED, /* M-H */
+ /* 201 */ ED_UNASSIGNED, /* M-I */
+ /* 202 */ ED_UNASSIGNED, /* M-J */
+ /* 203 */ ED_UNASSIGNED, /* M-K */
+ /* 204 */ ED_UNASSIGNED, /* M-L */
+ /* 205 */ ED_UNASSIGNED, /* M-M */
+ /* 206 */ ED_UNASSIGNED, /* M-N */
+ /* 207 */ ED_SEQUENCE_LEAD_IN, /* M-O */
+ /* 208 */ ED_UNASSIGNED, /* M-P */
+ /* 209 */ ED_UNASSIGNED, /* M-Q */
+ /* 210 */ ED_UNASSIGNED, /* M-R */
+ /* 211 */ ED_UNASSIGNED, /* M-S */
+ /* 212 */ ED_UNASSIGNED, /* M-T */
+ /* 213 */ ED_UNASSIGNED, /* M-U */
+ /* 214 */ ED_UNASSIGNED, /* M-V */
+ /* 215 */ ED_UNASSIGNED, /* M-W */
+ /* 216 */ ED_UNASSIGNED, /* M-X */
+ /* 217 */ ED_UNASSIGNED, /* M-Y */
+ /* 218 */ ED_UNASSIGNED, /* M-Z */
+ /* 219 */ ED_SEQUENCE_LEAD_IN, /* M-[ */
+ /* 220 */ ED_UNASSIGNED, /* M-\ */
+ /* 221 */ ED_UNASSIGNED, /* M-] */
+ /* 222 */ ED_UNASSIGNED, /* M-^ */
+ /* 223 */ ED_UNASSIGNED, /* M-_ */
+ /* 224 */ ED_UNASSIGNED, /* M-` */
+ /* 225 */ ED_UNASSIGNED, /* M-a */
+ /* 226 */ ED_UNASSIGNED, /* M-b */
+ /* 227 */ ED_UNASSIGNED, /* M-c */
+ /* 228 */ ED_UNASSIGNED, /* M-d */
+ /* 229 */ ED_UNASSIGNED, /* M-e */
+ /* 230 */ ED_UNASSIGNED, /* M-f */
+ /* 231 */ ED_UNASSIGNED, /* M-g */
+ /* 232 */ ED_UNASSIGNED, /* M-h */
+ /* 233 */ ED_UNASSIGNED, /* M-i */
+ /* 234 */ ED_UNASSIGNED, /* M-j */
+ /* 235 */ ED_UNASSIGNED, /* M-k */
+ /* 236 */ ED_UNASSIGNED, /* M-l */
+ /* 237 */ ED_UNASSIGNED, /* M-m */
+ /* 238 */ ED_UNASSIGNED, /* M-n */
+ /* 239 */ ED_UNASSIGNED, /* M-o */
+ /* 240 */ ED_UNASSIGNED, /* M-p */
+ /* 241 */ ED_UNASSIGNED, /* M-q */
+ /* 242 */ ED_UNASSIGNED, /* M-r */
+ /* 243 */ ED_UNASSIGNED, /* M-s */
+ /* 244 */ ED_UNASSIGNED, /* M-t */
+ /* 245 */ ED_UNASSIGNED, /* M-u */
+ /* 246 */ ED_UNASSIGNED, /* M-v */
+ /* 247 */ ED_UNASSIGNED, /* M-w */
+ /* 248 */ ED_UNASSIGNED, /* M-x */
+ /* 249 */ ED_UNASSIGNED, /* M-y */
+ /* 250 */ ED_UNASSIGNED, /* M-z */
+ /* 251 */ ED_UNASSIGNED, /* M-{ */
+ /* 252 */ ED_UNASSIGNED, /* M-| */
+ /* 253 */ ED_UNASSIGNED, /* M-} */
+ /* 254 */ ED_UNASSIGNED, /* M-~ */
+ /* 255 */ ED_UNASSIGNED /* M-^? */
+};
+
+
+/* map_init():
+ * Initialize and allocate the maps
+ */
+protected int
+map_init(EditLine *el)
+{
+
+ /*
+ * Make sure those are correct before starting.
+ */
+#ifdef MAP_DEBUG
+ if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t))
+ EL_ABORT((el->errfile, "Emacs map incorrect\n"));
+ if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t))
+ EL_ABORT((el->errfile, "Vi command map incorrect\n"));
+ if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t))
+ EL_ABORT((el->errfile, "Vi insert map incorrect\n"));
+#endif
+
+ el->el_map.alt = (el_action_t *)el_malloc(sizeof(el_action_t) * N_KEYS);
+ if (el->el_map.alt == NULL)
+ return (-1);
+ el->el_map.key = (el_action_t *)el_malloc(sizeof(el_action_t) * N_KEYS);
+ if (el->el_map.key == NULL)
+ return (-1);
+ el->el_map.emacs = el_map_emacs;
+ el->el_map.vic = el_map_vi_command;
+ el->el_map.vii = el_map_vi_insert;
+ el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) *
+ EL_NUM_FCNS);
+ if (el->el_map.help == NULL)
+ return (-1);
+ (void) memcpy(el->el_map.help, help__get(),
+ sizeof(el_bindings_t) * EL_NUM_FCNS);
+ el->el_map.func = (el_func_t *)el_malloc(sizeof(el_func_t) *
+ EL_NUM_FCNS);
+ if (el->el_map.func == NULL)
+ return (-1);
+ memcpy(el->el_map.func, func__get(), sizeof(el_func_t) * EL_NUM_FCNS);
+ el->el_map.nfunc = EL_NUM_FCNS;
+
+#ifdef VIDEFAULT
+ map_init_vi(el);
+#else
+ map_init_emacs(el);
+#endif /* VIDEFAULT */
+ return (0);
+}
+
+
+/* map_end():
+ * Free the space taken by the editor maps
+ */
+protected void
+map_end(EditLine *el)
+{
+
+ el_free((ptr_t) el->el_map.alt);
+ el->el_map.alt = NULL;
+ el_free((ptr_t) el->el_map.key);
+ el->el_map.key = NULL;
+ el->el_map.emacs = NULL;
+ el->el_map.vic = NULL;
+ el->el_map.vii = NULL;
+ el_free((ptr_t) el->el_map.help);
+ el->el_map.help = NULL;
+ el_free((ptr_t) el->el_map.func);
+ el->el_map.func = NULL;
+}
+
+
+/* map_init_nls():
+ * Find all the printable keys and bind them to self insert
+ */
+private void
+map_init_nls(EditLine *el)
+{
+ int i;
+
+ el_action_t *map = el->el_map.key;
+
+ for (i = 0200; i <= 0377; i++)
+ if (isprint(i))
+ map[i] = ED_INSERT;
+}
+
+
+/* map_init_meta():
+ * Bind all the meta keys to the appropriate ESC-<key> sequence
+ */
+private void
+map_init_meta(EditLine *el)
+{
+ char buf[3];
+ int i;
+ el_action_t *map = el->el_map.key;
+ el_action_t *alt = el->el_map.alt;
+
+ for (i = 0; i <= 0377 && map[i] != EM_META_NEXT; i++)
+ continue;
+
+ if (i > 0377) {
+ for (i = 0; i <= 0377 && alt[i] != EM_META_NEXT; i++)
+ continue;
+ if (i > 0377) {
+ i = 033;
+ if (el->el_map.type == MAP_VI)
+ map = alt;
+ } else
+ map = alt;
+ }
+ buf[0] = (char) i;
+ buf[2] = 0;
+ for (i = 0200; i <= 0377; i++)
+ switch (map[i]) {
+ case ED_INSERT:
+ case ED_UNASSIGNED:
+ case ED_SEQUENCE_LEAD_IN:
+ break;
+ default:
+ buf[1] = i & 0177;
+ key_add(el, buf, key_map_cmd(el, (int) map[i]), XK_CMD);
+ break;
+ }
+ map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN;
+}
+
+
+/* map_init_vi():
+ * Initialize the vi bindings
+ */
+protected void
+map_init_vi(EditLine *el)
+{
+ int i;
+ el_action_t *key = el->el_map.key;
+ el_action_t *alt = el->el_map.alt;
+ const el_action_t *vii = el->el_map.vii;
+ const el_action_t *vic = el->el_map.vic;
+
+ el->el_map.type = MAP_VI;
+ el->el_map.current = el->el_map.key;
+
+ key_reset(el);
+
+ for (i = 0; i < N_KEYS; i++) {
+ key[i] = vii[i];
+ alt[i] = vic[i];
+ }
+
+ map_init_meta(el);
+ map_init_nls(el);
+
+ tty_bind_char(el, 1);
+ term_bind_arrow(el);
+}
+
+
+/* map_init_emacs():
+ * Initialize the emacs bindings
+ */
+protected void
+map_init_emacs(EditLine *el)
+{
+ int i;
+ char buf[3];
+ el_action_t *key = el->el_map.key;
+ el_action_t *alt = el->el_map.alt;
+ const el_action_t *emacs = el->el_map.emacs;
+
+ el->el_map.type = MAP_EMACS;
+ el->el_map.current = el->el_map.key;
+ key_reset(el);
+
+ for (i = 0; i < N_KEYS; i++) {
+ key[i] = emacs[i];
+ alt[i] = ED_UNASSIGNED;
+ }
+
+ map_init_meta(el);
+ map_init_nls(el);
+
+ buf[0] = CONTROL('X');
+ buf[1] = CONTROL('X');
+ buf[2] = 0;
+ key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
+
+ tty_bind_char(el, 1);
+ term_bind_arrow(el);
+}
+
+
+/* map_set_editor():
+ * Set the editor
+ */
+protected int
+map_set_editor(EditLine *el, char *editor)
+{
+
+ if (strcmp(editor, "emacs") == 0) {
+ map_init_emacs(el);
+ return (0);
+ }
+ if (strcmp(editor, "vi") == 0) {
+ map_init_vi(el);
+ return (0);
+ }
+ return (-1);
+}
+
+
+/* map_get_editor():
+ * Retrieve the editor
+ */
+protected int
+map_get_editor(EditLine *el, const char **editor)
+{
+
+ if (editor == NULL)
+ return (-1);
+ switch (el->el_map.type) {
+ case MAP_EMACS:
+ *editor = "emacs";
+ return (0);
+ case MAP_VI:
+ *editor = "vi";
+ return (0);
+ }
+ return (-1);
+}
+
+
+/* map_print_key():
+ * Print the function description for 1 key
+ */
+private void
+map_print_key(EditLine *el, el_action_t *map, const char *in)
+{
+ char outbuf[EL_BUFSIZ];
+ el_bindings_t *bp, *ep;
+
+ if (in[0] == '\0' || in[1] == '\0') {
+ (void) key__decode_str(in, outbuf, sizeof(outbuf), "");
+ ep = &el->el_map.help[el->el_map.nfunc];
+ for (bp = el->el_map.help; bp < ep; bp++)
+ if (bp->func == map[(unsigned char) *in]) {
+ (void) fprintf(el->el_outfile,
+ "%s\t->\t%s\n", outbuf, bp->name);
+ return;
+ }
+ } else
+ key_print(el, in);
+}
+
+
+/* map_print_some_keys():
+ * Print keys from first to last
+ */
+private void
+map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
+{
+ el_bindings_t *bp, *ep;
+ char firstbuf[2], lastbuf[2];
+ char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ];
+
+ firstbuf[0] = first;
+ firstbuf[1] = 0;
+ lastbuf[0] = last;
+ lastbuf[1] = 0;
+ if (map[first] == ED_UNASSIGNED) {
+ if (first == last) {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
+ (void) fprintf(el->el_outfile,
+ "%-15s-> is undefined\n", unparsbuf);
+ }
+ return;
+ }
+ ep = &el->el_map.help[el->el_map.nfunc];
+ for (bp = el->el_map.help; bp < ep; bp++) {
+ if (bp->func == map[first]) {
+ if (first == last) {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
+ (void) fprintf(el->el_outfile, "%-15s-> %s\n",
+ unparsbuf, bp->name);
+ } else {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
+ (void) key__decode_str(lastbuf, extrabuf,
+ sizeof(extrabuf), STRQQ);
+ (void) fprintf(el->el_outfile,
+ "%-4s to %-7s-> %s\n",
+ unparsbuf, extrabuf, bp->name);
+ }
+ return;
+ }
+ }
+#ifdef MAP_DEBUG
+ if (map == el->el_map.key) {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
+ (void) fprintf(el->el_outfile,
+ "BUG!!! %s isn't bound to anything.\n", unparsbuf);
+ (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n",
+ first, el->el_map.key[first]);
+ } else {
+ (void) key__decode_str(firstbuf, unparsbuf,
+ sizeof(unparsbuf), STRQQ);
+ (void) fprintf(el->el_outfile,
+ "BUG!!! %s isn't bound to anything.\n", unparsbuf);
+ (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n",
+ first, el->el_map.alt[first]);
+ }
+#endif
+ EL_ABORT((el->el_errfile, "Error printing keys\n"));
+}
+
+
+/* map_print_all_keys():
+ * Print the function description for all keys.
+ */
+private void
+map_print_all_keys(EditLine *el)
+{
+ int prev, i;
+
+ (void) fprintf(el->el_outfile, "Standard key bindings\n");
+ prev = 0;
+ for (i = 0; i < N_KEYS; i++) {
+ if (el->el_map.key[prev] == el->el_map.key[i])
+ continue;
+ map_print_some_keys(el, el->el_map.key, prev, i - 1);
+ prev = i;
+ }
+ map_print_some_keys(el, el->el_map.key, prev, i - 1);
+
+ (void) fprintf(el->el_outfile, "Alternative key bindings\n");
+ prev = 0;
+ for (i = 0; i < N_KEYS; i++) {
+ if (el->el_map.alt[prev] == el->el_map.alt[i])
+ continue;
+ map_print_some_keys(el, el->el_map.alt, prev, i - 1);
+ prev = i;
+ }
+ map_print_some_keys(el, el->el_map.alt, prev, i - 1);
+
+ (void) fprintf(el->el_outfile, "Multi-character bindings\n");
+ key_print(el, "");
+ (void) fprintf(el->el_outfile, "Arrow key bindings\n");
+ term_print_arrow(el, "");
+}
+
+
+/* map_bind():
+ * Add/remove/change bindings
+ */
+protected int
+map_bind(EditLine *el, int argc, const char **argv)
+{
+ el_action_t *map;
+ int ntype, rem;
+ const char *p;
+ char inbuf[EL_BUFSIZ];
+ char outbuf[EL_BUFSIZ];
+ const char *in = NULL;
+ char *out = NULL;
+ el_bindings_t *bp, *ep;
+ int cmd;
+ int key;
+
+ if (argv == NULL)
+ return (-1);
+
+ map = el->el_map.key;
+ ntype = XK_CMD;
+ key = rem = 0;
+ for (argc = 1; (p = argv[argc]) != NULL; argc++)
+ if (p[0] == '-')
+ switch (p[1]) {
+ case 'a':
+ map = el->el_map.alt;
+ break;
+
+ case 's':
+ ntype = XK_STR;
+ break;
+#ifdef notyet
+ case 'c':
+ ntype = XK_EXE;
+ break;
+#endif
+ case 'k':
+ key = 1;
+ break;
+
+ case 'r':
+ rem = 1;
+ break;
+
+ case 'v':
+ map_init_vi(el);
+ return (0);
+
+ case 'e':
+ map_init_emacs(el);
+ return (0);
+
+ case 'l':
+ ep = &el->el_map.help[el->el_map.nfunc];
+ for (bp = el->el_map.help; bp < ep; bp++)
+ (void) fprintf(el->el_outfile,
+ "%s\n\t%s\n",
+ bp->name, bp->description);
+ return (0);
+ default:
+ (void) fprintf(el->el_errfile,
+ "%s: Invalid switch `%c'.\n",
+ argv[0], p[1]);
+ }
+ else
+ break;
+
+ if (argv[argc] == NULL) {
+ map_print_all_keys(el);
+ return (0);
+ }
+ if (key)
+ in = argv[argc++];
+ else if ((in = parse__string(inbuf, argv[argc++])) == NULL) {
+ (void) fprintf(el->el_errfile,
+ "%s: Invalid \\ or ^ in instring.\n",
+ argv[0]);
+ return (-1);
+ }
+ if (rem) {
+ if (key) {
+ (void) term_clear_arrow(el, in);
+ return (-1);
+ }
+ if (in[1])
+ (void) key_delete(el, in);
+ else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN)
+ (void) key_delete(el, in);
+ else
+ map[(unsigned char) *in] = ED_UNASSIGNED;
+ return (0);
+ }
+ if (argv[argc] == NULL) {
+ if (key)
+ term_print_arrow(el, in);
+ else
+ map_print_key(el, map, in);
+ return (0);
+ }
+#ifdef notyet
+ if (argv[argc + 1] != NULL) {
+ bindkey_usage();
+ return (-1);
+ }
+#endif
+
+ switch (ntype) {
+ case XK_STR:
+ case XK_EXE:
+ if ((out = parse__string(outbuf, argv[argc])) == NULL) {
+ (void) fprintf(el->el_errfile,
+ "%s: Invalid \\ or ^ in outstring.\n", argv[0]);
+ return (-1);
+ }
+ if (key)
+ term_set_arrow(el, in, key_map_str(el, out), ntype);
+ else
+ key_add(el, in, key_map_str(el, out), ntype);
+ map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
+ break;
+
+ case XK_CMD:
+ if ((cmd = parse_cmd(el, argv[argc])) == -1) {
+ (void) fprintf(el->el_errfile,
+ "%s: Invalid command `%s'.\n", argv[0], argv[argc]);
+ return (-1);
+ }
+ if (key)
+ term_set_arrow(el, in, key_map_str(el, out), ntype);
+ else {
+ if (in[1]) {
+ key_add(el, in, key_map_cmd(el, cmd), ntype);
+ map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
+ } else {
+ key_clear(el, map, in);
+ map[(unsigned char) *in] = cmd;
+ }
+ }
+ break;
+
+ default:
+ EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
+ break;
+ }
+ return (0);
+}
+
+
+/* map_addfunc():
+ * add a user defined function
+ */
+protected int
+map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
+{
+ void *p;
+ int nf = el->el_map.nfunc + 1;
+
+ if (name == NULL || help == NULL || func == NULL)
+ return (-1);
+
+ if ((p = el_realloc(el->el_map.func, nf * sizeof(el_func_t))) == NULL)
+ return (-1);
+ el->el_map.func = (el_func_t *) p;
+ if ((p = el_realloc(el->el_map.help, nf * sizeof(el_bindings_t)))
+ == NULL)
+ return (-1);
+ el->el_map.help = (el_bindings_t *) p;
+
+ nf = el->el_map.nfunc;
+ el->el_map.func[nf] = func;
+
+ el->el_map.help[nf].name = name;
+ el->el_map.help[nf].func = nf;
+ el->el_map.help[nf].description = help;
+ el->el_map.nfunc++;
+
+ return (0);
+}
diff --git a/frontend/libedit/map.h b/frontend/libedit/map.h
new file mode 100644
index 0000000..3b08f48
--- /dev/null
+++ b/frontend/libedit/map.h
@@ -0,0 +1,75 @@
+/* $NetBSD: map.h,v 1.8 2003/08/07 16:44:32 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)map.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.map.h: Editor maps
+ */
+#ifndef _h_el_map
+#define _h_el_map
+
+typedef struct el_bindings_t { /* for the "bind" shell command */
+ const char *name; /* function name for bind command */
+ int func; /* function numeric value */
+ const char *description; /* description of function */
+} el_bindings_t;
+
+
+typedef struct el_map_t {
+ el_action_t *alt; /* The current alternate key map */
+ el_action_t *key; /* The current normal key map */
+ el_action_t *current; /* The keymap we are using */
+ const el_action_t *emacs; /* The default emacs key map */
+ const el_action_t *vic; /* The vi command mode key map */
+ const el_action_t *vii; /* The vi insert mode key map */
+ int type; /* Emacs or vi */
+ el_bindings_t *help; /* The help for the editor functions */
+ el_func_t *func; /* List of available functions */
+ int nfunc; /* The number of functions/help items */
+} el_map_t;
+
+#define MAP_EMACS 0
+#define MAP_VI 1
+
+protected int map_bind(EditLine *, int, const char **);
+protected int map_init(EditLine *);
+protected void map_end(EditLine *);
+protected void map_init_vi(EditLine *);
+protected void map_init_emacs(EditLine *);
+protected int map_set_editor(EditLine *, char *);
+protected int map_get_editor(EditLine *, const char **);
+protected int map_addfunc(EditLine *, const char *, const char *, el_func_t);
+
+#endif /* _h_el_map */
diff --git a/frontend/libedit/mono-debugger-readline.c b/frontend/libedit/mono-debugger-readline.c
new file mode 100644
index 0000000..295240c
--- /dev/null
+++ b/frontend/libedit/mono-debugger-readline.c
@@ -0,0 +1,125 @@
+#include "config.h"
+#include <mono-debugger-readline.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern int rl_catch_signals;
+extern int rl_attempted_completion_over;
+
+static gboolean in_readline = FALSE;
+
+void
+mono_debugger_readline_static_init (void)
+{
+ rl_catch_signals = 1;
+ // rl_set_signals ();
+
+ rl_readline_name = "mdb";
+ rl_terminal_name = getenv ("TERM");
+}
+
+int
+mono_debugger_readline_is_a_tty (int fd)
+{
+ return isatty (fd);
+}
+
+char *
+mono_debugger_readline_readline (const char *prompt)
+{
+ char *line;
+ char *retval = NULL;
+
+ g_assert (!in_readline);
+ in_readline = TRUE;
+
+ line = readline (prompt);
+ retval = g_strdup (line);
+ if (line)
+ free (line);
+
+ in_readline = FALSE;
+ return retval;
+}
+
+void
+mono_debugger_readline_add_history (const char *line)
+{
+ add_history (line);
+}
+
+char*
+mono_debugger_readline_current_line_buffer (void)
+{
+ return g_strdup (rl_line_buffer);
+}
+
+extern int
+mono_debugger_readline_get_columns (void)
+{
+ int cols = 80;
+
+#if 0 /* FIXME */
+ rl_get_screen_size (NULL, &cols);
+#endif
+
+ return cols;
+}
+
+
+/* Completion stuff */
+
+int
+mono_debugger_readline_get_filename_completion_desired (void)
+{
+ return rl_filename_completion_desired;
+}
+
+void
+mono_debugger_readline_set_filename_completion_desired (int v)
+{
+ rl_filename_completion_desired = v;
+}
+
+static CompletionDelegate completion_cb;
+static char **my_completion_matches = NULL;
+
+void
+mono_debugger_readline_set_completion_matches (char **matches, int count)
+{
+ int i;
+
+ rl_attempted_completion_over = 1;
+
+ if (count == 0){
+ my_completion_matches = NULL;
+ return;
+ }
+
+ my_completion_matches = (char**)malloc (count * sizeof (char*));
+
+ for (i = 0; i < count; i ++)
+ my_completion_matches[i] = matches[i] ? strdup (matches[i]) : NULL;
+}
+
+static char**
+mono_debugger_readline_completion_function (const char *text, int start, int end)
+{
+ my_completion_matches = NULL;
+
+ if (completion_cb) {
+ completion_cb (text, start, end);
+ }
+ return my_completion_matches;
+}
+
+void
+mono_debugger_readline_enable_completion (CompletionDelegate cb)
+{
+ rl_attempted_completion_function = mono_debugger_readline_completion_function;
+
+ completion_cb = cb;
+}
+
diff --git a/frontend/libedit/mono-debugger-readline.h b/frontend/libedit/mono-debugger-readline.h
new file mode 100644
index 0000000..c547c75
--- /dev/null
+++ b/frontend/libedit/mono-debugger-readline.h
@@ -0,0 +1,27 @@
+#ifndef __MONO_DEBUGGER_READLINE_H__
+#define __MONO_DEBUGGER_READLINE_H__
+
+#include <glib.h>
+#include <stdio.h>
+#include <readline.h>
+
+G_BEGIN_DECLS
+
+typedef void (*CompletionDelegate)(const char *text, int start, int end);
+
+extern void mono_debugger_readline_static_init (void);
+extern int mono_debugger_readline_is_a_tty (int fd);
+extern char *mono_debugger_readline_readline (const char *prompt);
+extern void mono_debugger_readline_add_history (const char *line);
+extern void mono_debugger_readline_set_completion_matches (char **matches, int count);
+extern void mono_debugger_readline_enable_completion (CompletionDelegate cb);
+extern char* mono_debugger_readline_current_line_buffer (void);
+
+extern int mono_debugger_readline_get_filename_completion_desired (void);
+extern void mono_debugger_readline_set_filename_completion_desired (int v);
+
+extern int mono_debugger_readline_get_columns (void);
+
+G_END_DECLS
+
+#endif
diff --git a/frontend/libedit/parse.c b/frontend/libedit/parse.c
new file mode 100644
index 0000000..bf5ba3e
--- /dev/null
+++ b/frontend/libedit/parse.c
@@ -0,0 +1,257 @@
+/* $NetBSD: parse.c,v 1.22 2005/05/29 04:58:15 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * parse.c: parse an editline extended command
+ *
+ * commands are:
+ *
+ * bind
+ * echotc
+ * edit
+ * gettc
+ * history
+ * settc
+ * setty
+ */
+#include "el.h"
+#include <stdlib.h>
+
+private const struct {
+ const char *name;
+ int (*func)(EditLine *, int, const char **);
+} cmds[] = {
+ { "bind", map_bind },
+ { "echotc", term_echotc },
+ { "edit", el_editmode },
+ { "history", hist_command },
+ { "telltc", term_telltc },
+ { "settc", term_settc },
+ { "setty", tty_stty },
+ { NULL, NULL }
+};
+
+
+/* parse_line():
+ * Parse a line and dispatch it
+ */
+protected int
+parse_line(EditLine *el, const char *line)
+{
+ const char **argv;
+ int argc;
+ Tokenizer *tok;
+
+ tok = tok_init(NULL);
+ tok_str(tok, line, &argc, &argv);
+ argc = el_parse(el, argc, argv);
+ tok_end(tok);
+ return (argc);
+}
+
+
+/* el_parse():
+ * Command dispatcher
+ */
+public int
+el_parse(EditLine *el, int argc, const char *argv[])
+{
+ const char *ptr;
+ int i;
+
+ if (argc < 1)
+ return (-1);
+ ptr = strchr(argv[0], ':');
+ if (ptr != NULL) {
+ char *tprog;
+ size_t l;
+
+ if (ptr == argv[0])
+ return (0);
+ l = ptr - argv[0] - 1;
+ tprog = (char *) el_malloc(l + 1);
+ if (tprog == NULL)
+ return (0);
+ (void) strncpy(tprog, argv[0], l);
+ tprog[l] = '\0';
+ ptr++;
+ l = el_match(el->el_prog, tprog);
+ el_free(tprog);
+ if (!l)
+ return (0);
+ } else
+ ptr = argv[0];
+
+ for (i = 0; cmds[i].name != NULL; i++)
+ if (strcmp(cmds[i].name, ptr) == 0) {
+ i = (*cmds[i].func) (el, argc, argv);
+ return (-i);
+ }
+ return (-1);
+}
+
+
+/* parse__escape():
+ * Parse a string of the form ^<char> \<odigit> \<char> and return
+ * the appropriate character or -1 if the escape is not valid
+ */
+protected int
+parse__escape(const char **ptr)
+{
+ const char *p;
+ int c;
+
+ p = *ptr;
+
+ if (p[1] == 0)
+ return (-1);
+
+ if (*p == '\\') {
+ p++;
+ switch (*p) {
+ case 'a':
+ c = '\007'; /* Bell */
+ break;
+ case 'b':
+ c = '\010'; /* Backspace */
+ break;
+ case 't':
+ c = '\011'; /* Horizontal Tab */
+ break;
+ case 'n':
+ c = '\012'; /* New Line */
+ break;
+ case 'v':
+ c = '\013'; /* Vertical Tab */
+ break;
+ case 'f':
+ c = '\014'; /* Form Feed */
+ break;
+ case 'r':
+ c = '\015'; /* Carriage Return */
+ break;
+ case 'e':
+ c = '\033'; /* Escape */
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int cnt, ch;
+
+ for (cnt = 0, c = 0; cnt < 3; cnt++) {
+ ch = *p++;
+ if (ch < '0' || ch > '7') {
+ p--;
+ break;
+ }
+ c = (c << 3) | (ch - '0');
+ }
+ if ((c & 0xffffff00) != 0)
+ return (-1);
+ --p;
+ break;
+ }
+ default:
+ c = *p;
+ break;
+ }
+ } else if (*p == '^') {
+ p++;
+ c = (*p == '?') ? '\177' : (*p & 0237);
+ } else
+ c = *p;
+ *ptr = ++p;
+ return (c);
+}
+
+/* parse__string():
+ * Parse the escapes from in and put the raw string out
+ */
+protected char *
+parse__string(char *out, const char *in)
+{
+ char *rv = out;
+ int n;
+
+ for (;;)
+ switch (*in) {
+ case '\0':
+ *out = '\0';
+ return (rv);
+
+ case '\\':
+ case '^':
+ if ((n = parse__escape(&in)) == -1)
+ return (NULL);
+ *out++ = n;
+ break;
+
+ case 'M':
+ if (in[1] == '-' && in[2] != '\0') {
+ *out++ = '\033';
+ in += 2;
+ break;
+ }
+ /*FALLTHROUGH*/
+
+ default:
+ *out++ = *in++;
+ break;
+ }
+}
+
+
+/* parse_cmd():
+ * Return the command number for the command string given
+ * or -1 if one is not found
+ */
+protected int
+parse_cmd(EditLine *el, const char *cmd)
+{
+ el_bindings_t *b;
+
+ for (b = el->el_map.help; b->name != NULL; b++)
+ if (strcmp(b->name, cmd) == 0)
+ return (b->func);
+ return (-1);
+}
diff --git a/frontend/libedit/parse.h b/frontend/libedit/parse.h
new file mode 100644
index 0000000..58dced1
--- /dev/null
+++ b/frontend/libedit/parse.h
@@ -0,0 +1,48 @@
+/* $NetBSD: parse.h,v 1.6 2005/05/29 04:58:15 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)parse.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.parse.h: Parser functions
+ */
+#ifndef _h_el_parse
+#define _h_el_parse
+
+protected int parse_line(EditLine *, const char *);
+protected int parse__escape(const char **);
+protected char *parse__string(char *, const char *);
+protected int parse_cmd(EditLine *, const char *);
+
+#endif /* _h_el_parse */
diff --git a/frontend/libedit/prompt.c b/frontend/libedit/prompt.c
new file mode 100644
index 0000000..3ec9284
--- /dev/null
+++ b/frontend/libedit/prompt.c
@@ -0,0 +1,164 @@
+/* $NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * prompt.c: Prompt printing functions
+ */
+#include <stdio.h>
+#include "el.h"
+
+private char *prompt_default(EditLine *);
+private char *prompt_default_r(EditLine *);
+
+/* prompt_default():
+ * Just a default prompt, in case the user did not provide one
+ */
+private char *
+/*ARGSUSED*/
+prompt_default(EditLine *el __attribute__((__unused__)))
+{
+ static char a[3] = {'?', ' ', '\0'};
+
+ return (a);
+}
+
+
+/* prompt_default_r():
+ * Just a default rprompt, in case the user did not provide one
+ */
+private char *
+/*ARGSUSED*/
+prompt_default_r(EditLine *el __attribute__((__unused__)))
+{
+ static char a[1] = {'\0'};
+
+ return (a);
+}
+
+
+/* prompt_print():
+ * Print the prompt and update the prompt position.
+ * We use an array of integers in case we want to pass
+ * literal escape sequences in the prompt and we want a
+ * bit to flag them
+ */
+protected void
+prompt_print(EditLine *el, int op)
+{
+ el_prompt_t *elp;
+ char *p;
+
+ if (op == EL_PROMPT)
+ elp = &el->el_prompt;
+ else
+ elp = &el->el_rprompt;
+ p = (elp->p_func) (el);
+ while (*p)
+ re_putc(el, *p++, 1);
+
+ elp->p_pos.v = el->el_refresh.r_cursor.v;
+ elp->p_pos.h = el->el_refresh.r_cursor.h;
+}
+
+
+/* prompt_init():
+ * Initialize the prompt stuff
+ */
+protected int
+prompt_init(EditLine *el)
+{
+
+ el->el_prompt.p_func = prompt_default;
+ el->el_prompt.p_pos.v = 0;
+ el->el_prompt.p_pos.h = 0;
+ el->el_rprompt.p_func = prompt_default_r;
+ el->el_rprompt.p_pos.v = 0;
+ el->el_rprompt.p_pos.h = 0;
+ return (0);
+}
+
+
+/* prompt_end():
+ * Clean up the prompt stuff
+ */
+protected void
+/*ARGSUSED*/
+prompt_end(EditLine *el __attribute__((__unused__)))
+{
+}
+
+
+/* prompt_set():
+ * Install a prompt printing function
+ */
+protected int
+prompt_set(EditLine *el, el_pfunc_t prf, int op)
+{
+ el_prompt_t *p;
+
+ if (op == EL_PROMPT)
+ p = &el->el_prompt;
+ else
+ p = &el->el_rprompt;
+ if (prf == NULL) {
+ if (op == EL_PROMPT)
+ p->p_func = prompt_default;
+ else
+ p->p_func = prompt_default_r;
+ } else
+ p->p_func = prf;
+ p->p_pos.v = 0;
+ p->p_pos.h = 0;
+ return (0);
+}
+
+
+/* prompt_get():
+ * Retrieve the prompt printing function
+ */
+protected int
+prompt_get(EditLine *el, el_pfunc_t *prf, int op)
+{
+
+ if (prf == NULL)
+ return (-1);
+ if (op == EL_PROMPT)
+ *prf = el->el_prompt.p_func;
+ else
+ *prf = el->el_rprompt.p_func;
+ return (0);
+}
diff --git a/frontend/libedit/prompt.h b/frontend/libedit/prompt.h
new file mode 100644
index 0000000..d181108
--- /dev/null
+++ b/frontend/libedit/prompt.h
@@ -0,0 +1,58 @@
+/* $NetBSD: prompt.h,v 1.6 2003/08/07 16:44:32 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)prompt.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.prompt.h: Prompt printing stuff
+ */
+#ifndef _h_el_prompt
+#define _h_el_prompt
+
+#include "histedit.h"
+
+typedef char * (*el_pfunc_t)(EditLine*);
+
+typedef struct el_prompt_t {
+ el_pfunc_t p_func; /* Function to return the prompt */
+ coord_t p_pos; /* position in the line after prompt */
+} el_prompt_t;
+
+protected void prompt_print(EditLine *, int);
+protected int prompt_set(EditLine *, el_pfunc_t, int);
+protected int prompt_get(EditLine *, el_pfunc_t *, int);
+protected int prompt_init(EditLine *);
+protected void prompt_end(EditLine *);
+
+#endif /* _h_el_prompt */
diff --git a/frontend/libedit/read.c b/frontend/libedit/read.c
new file mode 100644
index 0000000..e3b1ffd
--- /dev/null
+++ b/frontend/libedit/read.c
@@ -0,0 +1,606 @@
+/* $NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * read.c: Clean this junk up! This is horrible code.
+ * Terminal read functions
+ */
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "el.h"
+
+#define OKCMD -1
+
+private int read__fixio(int, int);
+private int read_preread(EditLine *);
+private int read_char(EditLine *, char *);
+private int read_getcmd(EditLine *, el_action_t *, char *);
+
+/* read_init():
+ * Initialize the read stuff
+ */
+protected int
+read_init(EditLine *el)
+{
+ /* builtin read_char */
+ el->el_read.read_char = read_char;
+ return 0;
+}
+
+
+/* el_read_setfn():
+ * Set the read char function to the one provided.
+ * If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one.
+ */
+protected int
+el_read_setfn(EditLine *el, el_rfunc_t rc)
+{
+ el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc;
+ return 0;
+}
+
+
+/* el_read_getfn():
+ * return the current read char function, or EL_BUILTIN_GETCFN
+ * if it is the default one
+ */
+protected el_rfunc_t
+el_read_getfn(EditLine *el)
+{
+ return (el->el_read.read_char == read_char) ?
+ EL_BUILTIN_GETCFN : el->el_read.read_char;
+}
+
+
+#ifndef MIN
+#define MIN(A,B) ((A) < (B) ? (A) : (B))
+#endif
+
+#ifdef DEBUG_EDIT
+private void
+read_debug(EditLine *el)
+{
+
+ if (el->el_line.cursor > el->el_line.lastchar)
+ (void) fprintf(el->el_errfile, "cursor > lastchar\r\n");
+ if (el->el_line.cursor < el->el_line.buffer)
+ (void) fprintf(el->el_errfile, "cursor < buffer\r\n");
+ if (el->el_line.cursor > el->el_line.limit)
+ (void) fprintf(el->el_errfile, "cursor > limit\r\n");
+ if (el->el_line.lastchar > el->el_line.limit)
+ (void) fprintf(el->el_errfile, "lastchar > limit\r\n");
+ if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2])
+ (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
+}
+#endif /* DEBUG_EDIT */
+
+
+/* read__fixio():
+ * Try to recover from a read error
+ */
+/* ARGSUSED */
+private int
+read__fixio(int fd __attribute__((__unused__)), int e)
+{
+
+ switch (e) {
+ case -1: /* Make sure that the code is reachable */
+
+#ifdef EWOULDBLOCK
+ case EWOULDBLOCK:
+#ifndef TRY_AGAIN
+#define TRY_AGAIN
+#endif
+#endif /* EWOULDBLOCK */
+
+#if defined(POSIX) && defined(EAGAIN)
+#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+ case EAGAIN:
+#ifndef TRY_AGAIN
+#define TRY_AGAIN
+#endif
+#endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */
+#endif /* POSIX && EAGAIN */
+
+ e = 0;
+#ifdef TRY_AGAIN
+#if defined(F_SETFL) && defined(O_NDELAY)
+ if ((e = fcntl(fd, F_GETFL, 0)) == -1)
+ return (-1);
+
+ if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1)
+ return (-1);
+ else
+ e = 1;
+#endif /* F_SETFL && O_NDELAY */
+
+#ifdef FIONBIO
+ {
+ int zero = 0;
+
+ if (ioctl(fd, FIONBIO, (ioctl_t) & zero) == -1)
+ return (-1);
+ else
+ e = 1;
+ }
+#endif /* FIONBIO */
+
+#endif /* TRY_AGAIN */
+ return (e ? 0 : -1);
+
+ case EINTR:
+ return (0);
+
+ default:
+ return (-1);
+ }
+}
+
+
+/* read_preread():
+ * Try to read the stuff in the input queue;
+ */
+private int
+read_preread(EditLine *el)
+{
+ int chrs = 0;
+
+ if (el->el_tty.t_mode == ED_IO)
+ return (0);
+
+#ifdef FIONREAD
+ (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
+ if (chrs > 0) {
+ char buf[EL_BUFSIZ];
+
+ chrs = read(el->el_infd, buf,
+ (size_t) MIN(chrs, EL_BUFSIZ - 1));
+ if (chrs > 0) {
+ buf[chrs] = '\0';
+ el_push(el, buf);
+ }
+ }
+#endif /* FIONREAD */
+
+ return (chrs > 0);
+}
+
+
+/* el_push():
+ * Push a macro
+ */
+public void
+el_push(EditLine *el, char *str)
+{
+ c_macro_t *ma = &el->el_chared.c_macro;
+
+ if (str != NULL && ma->level + 1 < EL_MAXMACRO) {
+ ma->level++;
+ if ((ma->macro[ma->level] = el_strdup(str)) != NULL)
+ return;
+ ma->level--;
+ }
+ term_beep(el);
+ term__flush();
+}
+
+
+/* read_getcmd():
+ * Return next command from the input stream.
+ */
+private int
+read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
+{
+ el_action_t cmd;
+ int num;
+
+ do {
+ if ((num = el_getc(el, ch)) != 1) /* if EOF or error */
+ return (num);
+
+#ifdef KANJI
+ if ((*ch & 0200)) {
+ el->el_state.metanext = 0;
+ cmd = CcViMap[' '];
+ break;
+ } else
+#endif /* KANJI */
+
+ if (el->el_state.metanext) {
+ el->el_state.metanext = 0;
+ *ch |= 0200;
+ }
+ cmd = el->el_map.current[(unsigned char) *ch];
+ if (cmd == ED_SEQUENCE_LEAD_IN) {
+ key_value_t val;
+ switch (key_get(el, ch, &val)) {
+ case XK_CMD:
+ cmd = val.cmd;
+ break;
+ case XK_STR:
+ el_push(el, val.str);
+ break;
+#ifdef notyet
+ case XK_EXE:
+ /* XXX: In the future to run a user function */
+ RunCommand(val.str);
+ break;
+#endif
+ default:
+ EL_ABORT((el->el_errfile, "Bad XK_ type \n"));
+ break;
+ }
+ }
+ if (el->el_map.alt == NULL)
+ el->el_map.current = el->el_map.key;
+ } while (cmd == ED_SEQUENCE_LEAD_IN);
+ *cmdnum = cmd;
+ return (OKCMD);
+}
+
+
+/* read_char():
+ * Read a character from the tty.
+ */
+private int
+read_char(EditLine *el, char *cp)
+{
+ int num_read;
+ int tried = 0;
+
+ while ((num_read = read(el->el_infd, cp, 1)) == -1)
+ if (!tried && read__fixio(el->el_infd, errno) == 0)
+ tried = 1;
+ else {
+ *cp = '\0';
+ return (-1);
+ }
+
+ return (num_read);
+}
+
+
+/* el_getc():
+ * Read a character
+ */
+public int
+el_getc(EditLine *el, char *cp)
+{
+ int num_read;
+ c_macro_t *ma = &el->el_chared.c_macro;
+
+ term__flush();
+ for (;;) {
+ if (ma->level < 0) {
+ if (!read_preread(el))
+ break;
+ }
+ if (ma->level < 0)
+ break;
+
+ if (ma->macro[ma->level][ma->offset] == '\0') {
+ el_free(ma->macro[ma->level--]);
+ ma->offset = 0;
+ continue;
+ }
+ *cp = ma->macro[ma->level][ma->offset++] & 0377;
+ if (ma->macro[ma->level][ma->offset] == '\0') {
+ /* Needed for QuoteMode On */
+ el_free(ma->macro[ma->level--]);
+ ma->offset = 0;
+ }
+ return (1);
+ }
+
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile, "Turning raw mode on\n");
+#endif /* DEBUG_READ */
+ if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */
+ return (0);
+
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile, "Reading a character\n");
+#endif /* DEBUG_READ */
+ num_read = (*el->el_read.read_char)(el, cp);
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile, "Got it %c\n", *cp);
+#endif /* DEBUG_READ */
+ return (num_read);
+}
+
+protected void
+read_prepare(EditLine *el)
+{
+ if (el->el_flags & HANDLE_SIGNALS)
+ sig_set(el);
+ if (el->el_flags & NO_TTY)
+ return;
+ if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
+ tty_rawmode(el);
+
+ /* This is relatively cheap, and things go terribly wrong if
+ we have the wrong size. */
+ el_resize(el);
+ re_clear_display(el); /* reset the display stuff */
+ ch_reset(el, 0);
+ re_refresh(el); /* print the prompt */
+
+ if (el->el_flags & UNBUFFERED)
+ term__flush();
+}
+
+protected void
+read_finish(EditLine *el)
+{
+ if ((el->el_flags & UNBUFFERED) == 0)
+ (void) tty_cookedmode(el);
+ if (el->el_flags & HANDLE_SIGNALS)
+ sig_clr(el);
+}
+
+public const char *
+el_gets(EditLine *el, int *nread)
+{
+ int retval;
+ el_action_t cmdnum = 0;
+ int num; /* how many chars we have read at NL */
+ char ch;
+ int crlf = 0;
+#ifdef FIONREAD
+ c_macro_t *ma = &el->el_chared.c_macro;
+#endif /* FIONREAD */
+
+ if (el->el_flags & NO_TTY) {
+ char *cp = el->el_line.buffer;
+ size_t idx;
+
+ while ((*el->el_read.read_char)(el, cp) == 1) {
+ /* make sure there is space for next character */
+ if (cp + 1 >= el->el_line.limit) {
+ idx = (cp - el->el_line.buffer);
+ if (!ch_enlargebufs(el, 2))
+ break;
+ cp = &el->el_line.buffer[idx];
+ }
+ cp++;
+ if (el->el_flags & UNBUFFERED)
+ break;
+ if (cp[-1] == '\r' || cp[-1] == '\n')
+ break;
+ }
+
+ el->el_line.cursor = el->el_line.lastchar = cp;
+ *cp = '\0';
+ if (nread)
+ *nread = el->el_line.cursor - el->el_line.buffer;
+ return (el->el_line.buffer);
+ }
+
+
+#ifdef FIONREAD
+ if (el->el_tty.t_mode == EX_IO && ma->level < 0) {
+ long chrs = 0;
+
+ (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
+ if (chrs == 0) {
+ if (tty_rawmode(el) < 0) {
+ if (nread)
+ *nread = 0;
+ return (NULL);
+ }
+ }
+ }
+#endif /* FIONREAD */
+
+ if ((el->el_flags & UNBUFFERED) == 0)
+ read_prepare(el);
+
+ if (el->el_flags & EDIT_DISABLED) {
+ char *cp;
+ size_t idx;
+ if ((el->el_flags & UNBUFFERED) == 0)
+ cp = el->el_line.buffer;
+ else
+ cp = el->el_line.lastchar;
+
+ term__flush();
+
+ while ((*el->el_read.read_char)(el, cp) == 1) {
+ /* make sure there is space next character */
+ if (cp + 1 >= el->el_line.limit) {
+ idx = (cp - el->el_line.buffer);
+ if (!ch_enlargebufs(el, 2))
+ break;
+ cp = &el->el_line.buffer[idx];
+ }
+ if (*cp == 4) /* ought to be stty eof */
+ break;
+ cp++;
+ crlf = cp[-1] == '\r' || cp[-1] == '\n';
+ if (el->el_flags & UNBUFFERED)
+ break;
+ if (crlf)
+ break;
+ }
+
+ el->el_line.cursor = el->el_line.lastchar = cp;
+ *cp = '\0';
+ if (nread)
+ *nread = el->el_line.cursor - el->el_line.buffer;
+ return (el->el_line.buffer);
+ }
+
+ for (num = OKCMD; num == OKCMD;) { /* while still editing this
+ * line */
+#ifdef DEBUG_EDIT
+ read_debug(el);
+#endif /* DEBUG_EDIT */
+ /* if EOF or error */
+ if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile,
+ "Returning from el_gets %d\n", num);
+#endif /* DEBUG_READ */
+ break;
+ }
+ if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */
+#ifdef DEBUG_EDIT
+ (void) fprintf(el->el_errfile,
+ "ERROR: illegal command from key 0%o\r\n", ch);
+#endif /* DEBUG_EDIT */
+ continue; /* try again */
+ }
+ /* now do the real command */
+#ifdef DEBUG_READ
+ {
+ el_bindings_t *b;
+ for (b = el->el_map.help; b->name; b++)
+ if (b->func == cmdnum)
+ break;
+ if (b->name)
+ (void) fprintf(el->el_errfile,
+ "Executing %s\n", b->name);
+ else
+ (void) fprintf(el->el_errfile,
+ "Error command = %d\n", cmdnum);
+ }
+#endif /* DEBUG_READ */
+ /* vi redo needs these way down the levels... */
+ el->el_state.thiscmd = cmdnum;
+ el->el_state.thisch = ch;
+ if (el->el_map.type == MAP_VI &&
+ el->el_map.current == el->el_map.key &&
+ el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
+ if (cmdnum == VI_DELETE_PREV_CHAR &&
+ el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
+ && isprint((unsigned char)el->el_chared.c_redo.pos[-1]))
+ el->el_chared.c_redo.pos--;
+ else
+ *el->el_chared.c_redo.pos++ = ch;
+ }
+ retval = (*el->el_map.func[cmdnum]) (el, ch);
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile,
+ "Returned state %d\n", retval );
+#endif /* DEBUG_READ */
+
+ /* save the last command here */
+ el->el_state.lastcmd = cmdnum;
+
+ /* use any return value */
+ switch (retval) {
+ case CC_CURSOR:
+ re_refresh_cursor(el);
+ break;
+
+ case CC_REDISPLAY:
+ re_clear_lines(el);
+ re_clear_display(el);
+ /* FALLTHROUGH */
+
+ case CC_REFRESH:
+ re_refresh(el);
+ break;
+
+ case CC_REFRESH_BEEP:
+ re_refresh(el);
+ term_beep(el);
+ break;
+
+ case CC_NORM: /* normal char */
+ break;
+
+ case CC_ARGHACK: /* Suggested by Rich Salz */
+ /* <rsalz at pineapple.bbn.com> */
+ continue; /* keep going... */
+
+ case CC_EOF: /* end of file typed */
+ if ((el->el_flags & UNBUFFERED) == 0)
+ num = 0;
+ else if (num == -1) {
+ *el->el_line.lastchar++ = CONTROL('d');
+ el->el_line.cursor = el->el_line.lastchar;
+ num = 1;
+ }
+ break;
+
+ case CC_NEWLINE: /* normal end of line */
+ num = el->el_line.lastchar - el->el_line.buffer;
+ break;
+
+ case CC_FATAL: /* fatal error, reset to known state */
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile,
+ "*** editor fatal ERROR ***\r\n\n");
+#endif /* DEBUG_READ */
+ /* put (real) cursor in a known place */
+ re_clear_display(el); /* reset the display stuff */
+ ch_reset(el, 1); /* reset the input pointers */
+ re_refresh(el); /* print the prompt again */
+ break;
+
+ case CC_ERROR:
+ default: /* functions we don't know about */
+#ifdef DEBUG_READ
+ (void) fprintf(el->el_errfile,
+ "*** editor ERROR ***\r\n\n");
+#endif /* DEBUG_READ */
+ term_beep(el);
+ term__flush();
+ break;
+ }
+ el->el_state.argument = 1;
+ el->el_state.doingarg = 0;
+ el->el_chared.c_vcmd.action = NOP;
+ if (el->el_flags & UNBUFFERED)
+ break;
+ }
+
+ term__flush(); /* flush any buffered output */
+ /* make sure the tty is set up correctly */
+ if ((el->el_flags & UNBUFFERED) == 0) {
+ read_finish(el);
+ if (nread)
+ *nread = num;
+ } else {
+ if (nread)
+ *nread = el->el_line.lastchar - el->el_line.buffer;
+ }
+ return (num ? el->el_line.buffer : NULL);
+}
diff --git a/frontend/libedit/read.h b/frontend/libedit/read.h
new file mode 100644
index 0000000..61952a2
--- /dev/null
+++ b/frontend/libedit/read.h
@@ -0,0 +1,53 @@
+/* $NetBSD: read.h,v 1.5 2006/08/21 12:45:30 christos Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Anthony Mallet.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * el.read.h: Character reading functions
+ */
+#ifndef _h_el_read
+#define _h_el_read
+
+typedef int (*el_rfunc_t)(EditLine *, char *);
+
+typedef struct el_read_t {
+ el_rfunc_t read_char; /* Function to read a character */
+} el_read_t;
+
+protected int read_init(EditLine *);
+protected void read_prepare(EditLine *);
+protected void read_finish(EditLine *);
+protected int el_read_setfn(EditLine *, el_rfunc_t);
+protected el_rfunc_t el_read_getfn(EditLine *);
+
+#endif /* _h_el_read */
diff --git a/frontend/libedit/readline.c b/frontend/libedit/readline.c
new file mode 100644
index 0000000..4373916
--- /dev/null
+++ b/frontend/libedit/readline.c
@@ -0,0 +1,1816 @@
+/* $NetBSD: readline.c,v 1.69 2006/08/21 12:45:30 christos Exp $ */
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jaromir Dolecek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* AIX requires this to be the first thing in the file. */
+#if defined (_AIX) && !defined (__GNUC__)
+ #pragma alloca
+#endif
+
+#include <config.h>
+
+#ifdef __GNUC__
+# undef alloca
+# define alloca(n) __builtin_alloca (n)
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifndef _AIX
+extern char *alloca ();
+# endif
+# endif
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <string.h>
+#include <pwd.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <vis.h>
+
+#include "sys.h"
+#include "el.h"
+#include "fcns.h" /* for EL_NUM_FCNS */
+#include "histedit.h"
+#include "readline.h"
+#include "filecomplete.h"
+
+void rl_prep_terminal(int);
+void rl_deprep_terminal(void);
+
+/* for rl_complete() */
+#define TAB '\r'
+
+/* see comment at the #ifdef for sense of this */
+/* #define GDB_411_HACK */
+
+/* readline compatibility stuff - look at readline sources/documentation */
+/* to see what these variables mean */
+const char *rl_library_version = "EditLine wrapper";
+static char empty[] = { '\0' };
+static char expand_chars[] = { ' ', '\t', '\n', '=', '(', '\0' };
+static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$',
+ '>', '<', '=', ';', '|', '&', '{', '(', '\0' };
+char *rl_readline_name = empty;
+FILE *rl_instream = NULL;
+FILE *rl_outstream = NULL;
+int rl_point = 0;
+int rl_end = 0;
+char *rl_line_buffer = NULL;
+VCPFunction *rl_linefunc = NULL;
+int rl_done = 0;
+VFunction *rl_event_hook = NULL;
+
+int history_base = 1; /* probably never subject to change */
+int history_length = 0;
+int max_input_history = 0;
+char history_expansion_char = '!';
+char history_subst_char = '^';
+char *history_no_expand_chars = expand_chars;
+Function *history_inhibit_expansion_function = NULL;
+char *history_arg_extract(int start, int end, const char *str);
+
+int rl_inhibit_completion = 0;
+int rl_attempted_completion_over = 0;
+char *rl_basic_word_break_characters = break_chars;
+char *rl_completer_word_break_characters = NULL;
+char *rl_completer_quote_characters = NULL;
+Function *rl_completion_entry_function = NULL;
+CPPFunction *rl_attempted_completion_function = NULL;
+Function *rl_pre_input_hook = NULL;
+Function *rl_startup1_hook = NULL;
+Function *rl_getc_function = NULL;
+char *rl_terminal_name = NULL;
+int rl_already_prompted = 0;
+int rl_filename_completion_desired = 0;
+int rl_ignore_completion_duplicates = 0;
+int rl_catch_signals = 1;
+VFunction *rl_redisplay_function = NULL;
+Function *rl_startup_hook = NULL;
+VFunction *rl_completion_display_matches_hook = NULL;
+VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
+VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
+
+/*
+ * The current prompt string.
+ */
+char *rl_prompt = NULL;
+/*
+ * This is set to character indicating type of completion being done by
+ * rl_complete_internal(); this is available for application completion
+ * functions.
+ */
+int rl_completion_type = 0;
+
+/*
+ * If more than this number of items results from query for possible
+ * completions, we ask user if they are sure to really display the list.
+ */
+int rl_completion_query_items = 100;
+
+/*
+ * List of characters which are word break characters, but should be left
+ * in the parsed text when it is passed to the completion function.
+ * Shell uses this to help determine what kind of completing to do.
+ */
+char *rl_special_prefixes = NULL;
+
+/*
+ * This is the character appended to the completed words if at the end of
+ * the line. Default is ' ' (a space).
+ */
+int rl_completion_append_character = ' ';
+
+/* stuff below is used internally by libedit for readline emulation */
+
+static History *h = NULL;
+static EditLine *e = NULL;
+static Function *map[256];
+
+/* internal functions */
+static unsigned char _el_rl_complete(EditLine *, int);
+static unsigned char _el_rl_tstp(EditLine *, int);
+static char *_get_prompt(EditLine *);
+static int _getc_function(EditLine *, char *);
+static HIST_ENTRY *_move_history(int);
+static int _history_expand_command(const char *, size_t, size_t,
+ char **);
+static char *_rl_compat_sub(const char *, const char *,
+ const char *, int);
+static int _rl_event_read_char(EditLine *, char *);
+static void _rl_update_pos(void);
+
+
+/* ARGSUSED */
+static char *
+_get_prompt(EditLine *el __attribute__((__unused__)))
+{
+ rl_already_prompted = 1;
+ return (rl_prompt);
+}
+
+
+/*
+ * generic function for moving around history
+ */
+static HIST_ENTRY *
+_move_history(int op)
+{
+ HistEvent ev;
+ static HIST_ENTRY rl_he;
+
+ if (history(h, &ev, op) != 0)
+ return (HIST_ENTRY *) NULL;
+
+ rl_he.line = ev.str;
+ rl_he.data = (histdata_t) &(ev.num);
+
+ return (&rl_he);
+}
+
+
+/*
+ * read one key from user defined input function
+ */
+static int
+/*ARGSUSED*/
+_getc_function(EditLine *el, char *c)
+{
+ int i;
+
+ i = (*rl_getc_function)(NULL, 0);
+ if (i == -1)
+ return 0;
+ *c = i;
+ return 1;
+}
+
+
+/*
+ * READLINE compatibility stuff
+ */
+
+/*
+ * initialize rl compat stuff
+ */
+int
+rl_initialize(void)
+{
+ HistEvent ev;
+ const LineInfo *li;
+ int editmode = 1;
+ struct termios t;
+
+ if (e != NULL)
+ el_end(e);
+ if (h != NULL)
+ history_end(h);
+
+ if (!rl_instream)
+ rl_instream = stdin;
+ if (!rl_outstream)
+ rl_outstream = stdout;
+
+ /*
+ * See if we don't really want to run the editor
+ */
+ if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & ECHO) == 0)
+ editmode = 0;
+
+ e = el_init(rl_readline_name, rl_instream, rl_outstream, stderr);
+
+ if (!editmode)
+ el_set(e, EL_EDITMODE, 0);
+
+ h = history_init();
+ if (!e || !h)
+ return (-1);
+
+ history(h, &ev, H_SETSIZE, INT_MAX); /* unlimited */
+ history_length = 0;
+ max_input_history = INT_MAX;
+ el_set(e, EL_HIST, history, h);
+
+ /* setup getc function if valid */
+ if (rl_getc_function)
+ el_set(e, EL_GETCFN, _getc_function);
+
+ /* for proper prompt printing in readline() */
+ rl_prompt = strdup("");
+ if (rl_prompt == NULL) {
+ history_end(h);
+ el_end(e);
+ return -1;
+ }
+ el_set(e, EL_PROMPT, _get_prompt);
+ el_set(e, EL_SIGNAL, rl_catch_signals);
+
+ /* set default mode to "emacs"-style and read setting afterwards */
+ /* so this can be overriden */
+ el_set(e, EL_EDITOR, "emacs");
+ if (rl_terminal_name != NULL)
+ el_set(e, EL_TERMINAL, rl_terminal_name);
+ else
+ el_get(e, EL_TERMINAL, &rl_terminal_name);
+
+ /*
+ * Word completion - this has to go AFTER rebinding keys
+ * to emacs-style.
+ */
+ el_set(e, EL_ADDFN, "rl_complete",
+ "ReadLine compatible completion function",
+ _el_rl_complete);
+ el_set(e, EL_BIND, "^I", "rl_complete", NULL);
+
+ /*
+ * Send TSTP when ^Z is pressed.
+ */
+ el_set(e, EL_ADDFN, "rl_tstp",
+ "ReadLine compatible suspend function",
+ _el_rl_tstp);
+ el_set(e, EL_BIND, "^Z", "rl_tstp", NULL);
+
+ /* read settings from configuration file */
+ el_source(e, NULL);
+
+ /*
+ * Unfortunately, some applications really do use rl_point
+ * and rl_line_buffer directly.
+ */
+ li = el_line(e);
+ /* a cheesy way to get rid of const cast. */
+ rl_line_buffer = memchr(li->buffer, *li->buffer, 1);
+ _rl_update_pos();
+
+ if (rl_startup_hook)
+ (*rl_startup_hook)(NULL, 0);
+
+ return (0);
+}
+
+
+/*
+ * read one line from input stream and return it, chomping
+ * trailing newline (if there is any)
+ */
+char *
+readline(const char *prompt)
+{
+ HistEvent ev;
+ int count;
+ const char *ret;
+ char *buf;
+ static int used_event_hook;
+
+ if (e == NULL || h == NULL)
+ rl_initialize();
+
+ rl_done = 0;
+
+ /* update prompt accordingly to what has been passed */
+ if (!prompt)
+ prompt = "";
+ if (strcmp(rl_prompt, prompt) != 0) {
+ free(rl_prompt);
+ rl_prompt = strdup(prompt);
+ if (rl_prompt == NULL)
+ return NULL;
+ }
+
+ if (rl_pre_input_hook)
+ (*rl_pre_input_hook)(NULL, 0);
+
+ if (rl_event_hook && !(e->el_flags&NO_TTY)) {
+ el_set(e, EL_GETCFN, _rl_event_read_char);
+ used_event_hook = 1;
+ }
+
+ if (!rl_event_hook && used_event_hook) {
+ el_set(e, EL_GETCFN, EL_BUILTIN_GETCFN);
+ used_event_hook = 0;
+ }
+
+ rl_already_prompted = 0;
+
+ /* get one line from input stream */
+ ret = el_gets(e, &count);
+
+ if (ret && count > 0) {
+ int lastidx;
+
+ buf = strdup(ret);
+ if (buf == NULL)
+ return NULL;
+ lastidx = count - 1;
+ if (buf[lastidx] == '\n')
+ buf[lastidx] = '\0';
+ } else
+ buf = NULL;
+
+ history(h, &ev, H_GETSIZE);
+ history_length = ev.num;
+
+ return buf;
+}
+
+/*
+ * history functions
+ */
+
+/*
+ * is normally called before application starts to use
+ * history expansion functions
+ */
+void
+using_history(void)
+{
+ if (h == NULL || e == NULL)
+ rl_initialize();
+}
+
+
+/*
+ * substitute ``what'' with ``with'', returning resulting string; if
+ * globally == 1, substitutes all occurrences of what, otherwise only the
+ * first one
+ */
+static char *
+_rl_compat_sub(const char *str, const char *what, const char *with,
+ int globally)
+{
+ const char *s;
+ char *r, *result;
+ size_t len, with_len, what_len;
+
+ len = strlen(str);
+ with_len = strlen(with);
+ what_len = strlen(what);
+
+ /* calculate length we need for result */
+ s = str;
+ while (*s) {
+ if (*s == *what && !strncmp(s, what, what_len)) {
+ len += with_len - what_len;
+ if (!globally)
+ break;
+ s += what_len;
+ } else
+ s++;
+ }
+ r = result = malloc(len + 1);
+ if (result == NULL)
+ return NULL;
+ s = str;
+ while (*s) {
+ if (*s == *what && !strncmp(s, what, what_len)) {
+ (void)strncpy(r, with, with_len);
+ r += with_len;
+ s += what_len;
+ if (!globally) {
+ (void)strcpy(r, s);
+ return(result);
+ }
+ } else
+ *r++ = *s++;
+ }
+ *r = 0;
+ return(result);
+}
+
+static char *last_search_pat; /* last !?pat[?] search pattern */
+static char *last_search_match; /* last !?pat[?] that matched */
+
+const char *
+get_history_event(const char *cmd, int *cindex, int qchar)
+{
+ int idx, sign, sub, num, begin, ret;
+ size_t len;
+ char *pat;
+ const char *rptr;
+ HistEvent ev;
+
+ idx = *cindex;
+ if (cmd[idx++] != history_expansion_char)
+ return(NULL);
+
+ /* find out which event to take */
+ if (cmd[idx] == history_expansion_char || cmd[idx] == 0) {
+ if (history(h, &ev, H_FIRST) != 0)
+ return(NULL);
+ *cindex = cmd[idx]? (idx + 1):idx;
+ return(ev.str);
+ }
+ sign = 0;
+ if (cmd[idx] == '-') {
+ sign = 1;
+ idx++;
+ }
+
+ if ('0' <= cmd[idx] && cmd[idx] <= '9') {
+ HIST_ENTRY *rl_he;
+
+ num = 0;
+ while (cmd[idx] && '0' <= cmd[idx] && cmd[idx] <= '9') {
+ num = num * 10 + cmd[idx] - '0';
+ idx++;
+ }
+ if (sign)
+ num = history_length - num + 1;
+
+ if (!(rl_he = history_get(num)))
+ return(NULL);
+
+ *cindex = idx;
+ return(rl_he->line);
+ }
+ sub = 0;
+ if (cmd[idx] == '?') {
+ sub = 1;
+ idx++;
+ }
+ begin = idx;
+ while (cmd[idx]) {
+ if (cmd[idx] == '\n')
+ break;
+ if (sub && cmd[idx] == '?')
+ break;
+ if (!sub && (cmd[idx] == ':' || cmd[idx] == ' '
+ || cmd[idx] == '\t' || cmd[idx] == qchar))
+ break;
+ idx++;
+ }
+ len = idx - begin;
+ if (sub && cmd[idx] == '?')
+ idx++;
+ if (sub && len == 0 && last_search_pat && *last_search_pat)
+ pat = last_search_pat;
+ else if (len == 0)
+ return(NULL);
+ else {
+ if ((pat = malloc(len + 1)) == NULL)
+ return NULL;
+ (void)strncpy(pat, cmd + begin, len);
+ pat[len] = '\0';
+ }
+
+ if (history(h, &ev, H_CURR) != 0) {
+ if (pat != last_search_pat)
+ free(pat);
+ return (NULL);
+ }
+ num = ev.num;
+
+ if (sub) {
+ if (pat != last_search_pat) {
+ if (last_search_pat)
+ free(last_search_pat);
+ last_search_pat = pat;
+ }
+ ret = history_search(pat, -1);
+ } else
+ ret = history_search_prefix(pat, -1);
+
+ if (ret == -1) {
+ /* restore to end of list on failed search */
+ history(h, &ev, H_FIRST);
+ (void)fprintf(rl_outstream, "%s: Event not found\n", pat);
+ if (pat != last_search_pat)
+ free(pat);
+ return(NULL);
+ }
+
+ if (sub && len) {
+ if (last_search_match && last_search_match != pat)
+ free(last_search_match);
+ last_search_match = pat;
+ }
+
+ if (pat != last_search_pat)
+ free(pat);
+
+ if (history(h, &ev, H_CURR) != 0)
+ return(NULL);
+ *cindex = idx;
+ rptr = ev.str;
+
+ /* roll back to original position */
+ (void)history(h, &ev, H_SET, num);
+
+ return rptr;
+}
+
+/*
+ * the real function doing history expansion - takes as argument command
+ * to do and data upon which the command should be executed
+ * does expansion the way I've understood readline documentation
+ *
+ * returns 0 if data was not modified, 1 if it was and 2 if the string
+ * should be only printed and not executed; in case of error,
+ * returns -1 and *result points to NULL
+ * it's callers responsibility to free() string returned in *result
+ */
+static int
+_history_expand_command(const char *command, size_t offs, size_t cmdlen,
+ char **result)
+{
+ char *tmp, *search = NULL, *aptr;
+ const char *ptr, *cmd;
+ static char *from = NULL, *to = NULL;
+ int start, end, idx, has_mods = 0;
+ int p_on = 0, g_on = 0;
+
+ *result = NULL;
+ aptr = NULL;
+ ptr = NULL;
+
+ /* First get event specifier */
+ idx = 0;
+
+ if (strchr(":^*$", command[offs + 1])) {
+ char str[4];
+ /*
+ * "!:" is shorthand for "!!:".
+ * "!^", "!*" and "!$" are shorthand for
+ * "!!:^", "!!:*" and "!!:$" respectively.
+ */
+ str[0] = str[1] = '!';
+ str[2] = '0';
+ ptr = get_history_event(str, &idx, 0);
+ idx = (command[offs + 1] == ':')? 1:0;
+ has_mods = 1;
+ } else {
+ if (command[offs + 1] == '#') {
+ /* use command so far */
+ if ((aptr = malloc(offs + 1)) == NULL)
+ return -1;
+ (void)strncpy(aptr, command, offs);
+ aptr[offs] = '\0';
+ idx = 1;
+ } else {
+ int qchar;
+
+ qchar = (offs > 0 && command[offs - 1] == '"')? '"':0;
+ ptr = get_history_event(command + offs, &idx, qchar);
+ }
+ has_mods = command[offs + idx] == ':';
+ }
+
+ if (ptr == NULL && aptr == NULL)
+ return(-1);
+
+ if (!has_mods) {
+ *result = strdup(aptr? aptr : ptr);
+ if (aptr)
+ free(aptr);
+ return(1);
+ }
+
+ cmd = command + offs + idx + 1;
+
+ /* Now parse any word designators */
+
+ if (*cmd == '%') /* last word matched by ?pat? */
+ tmp = strdup(last_search_match? last_search_match:"");
+ else if (strchr("^*$-0123456789", *cmd)) {
+ start = end = -1;
+ if (*cmd == '^')
+ start = end = 1, cmd++;
+ else if (*cmd == '$')
+ start = -1, cmd++;
+ else if (*cmd == '*')
+ start = 1, cmd++;
+ else if (*cmd == '-' || isdigit((unsigned char) *cmd)) {
+ start = 0;
+ while (*cmd && '0' <= *cmd && *cmd <= '9')
+ start = start * 10 + *cmd++ - '0';
+
+ if (*cmd == '-') {
+ if (isdigit((unsigned char) cmd[1])) {
+ cmd++;
+ end = 0;
+ while (*cmd && '0' <= *cmd && *cmd <= '9')
+ end = end * 10 + *cmd++ - '0';
+ } else if (cmd[1] == '$') {
+ cmd += 2;
+ end = -1;
+ } else {
+ cmd++;
+ end = -2;
+ }
+ } else if (*cmd == '*')
+ end = -1, cmd++;
+ else
+ end = start;
+ }
+ tmp = history_arg_extract(start, end, aptr? aptr:ptr);
+ if (tmp == NULL) {
+ (void)fprintf(rl_outstream, "%s: Bad word specifier",
+ command + offs + idx);
+ if (aptr)
+ free(aptr);
+ return(-1);
+ }
+ } else
+ tmp = strdup(aptr? aptr:ptr);
+
+ if (aptr)
+ free(aptr);
+
+ if (*cmd == 0 || (cmd - (command + offs) >= cmdlen)) {
+ *result = tmp;
+ return(1);
+ }
+
+ for (; *cmd; cmd++) {
+ if (*cmd == ':')
+ continue;
+ else if (*cmd == 'h') { /* remove trailing path */
+ if ((aptr = strrchr(tmp, '/')) != NULL)
+ *aptr = 0;
+ } else if (*cmd == 't') { /* remove leading path */
+ if ((aptr = strrchr(tmp, '/')) != NULL) {
+ aptr = strdup(aptr + 1);
+ free(tmp);
+ tmp = aptr;
+ }
+ } else if (*cmd == 'r') { /* remove trailing suffix */
+ if ((aptr = strrchr(tmp, '.')) != NULL)
+ *aptr = 0;
+ } else if (*cmd == 'e') { /* remove all but suffix */
+ if ((aptr = strrchr(tmp, '.')) != NULL) {
+ aptr = strdup(aptr);
+ free(tmp);
+ tmp = aptr;
+ }
+ } else if (*cmd == 'p') /* print only */
+ p_on = 1;
+ else if (*cmd == 'g')
+ g_on = 2;
+ else if (*cmd == 's' || *cmd == '&') {
+ char *what, *with, delim;
+ size_t len, from_len;
+ size_t size;
+
+ if (*cmd == '&' && (from == NULL || to == NULL))
+ continue;
+ else if (*cmd == 's') {
+ delim = *(++cmd), cmd++;
+ size = 16;
+ what = realloc(from, size);
+ if (what == NULL) {
+ free(from);
+ free(tmp);
+ return 0;
+ }
+ len = 0;
+ for (; *cmd && *cmd != delim; cmd++) {
+ if (*cmd == '\\' && cmd[1] == delim)
+ cmd++;
+ if (len >= size) {
+ char *nwhat;
+ nwhat = realloc(what,
+ (size <<= 1));
+ if (nwhat == NULL) {
+ free(what);
+ free(tmp);
+ return 0;
+ }
+ what = nwhat;
+ }
+ what[len++] = *cmd;
+ }
+ what[len] = '\0';
+ from = what;
+ if (*what == '\0') {
+ free(what);
+ if (search) {
+ from = strdup(search);
+ if (from == NULL) {
+ free(tmp);
+ return 0;
+ }
+ } else {
+ from = NULL;
+ free(tmp);
+ return (-1);
+ }
+ }
+ cmd++; /* shift after delim */
+ if (!*cmd)
+ continue;
+
+ size = 16;
+ with = realloc(to, size);
+ if (with == NULL) {
+ free(to);
+ free(tmp);
+ return -1;
+ }
+ len = 0;
+ from_len = strlen(from);
+ for (; *cmd && *cmd != delim; cmd++) {
+ if (len + from_len + 1 >= size) {
+ char *nwith;
+ size += from_len + 1;
+ nwith = realloc(with, size);
+ if (nwith == NULL) {
+ free(with);
+ free(tmp);
+ return -1;
+ }
+ with = nwith;
+ }
+ if (*cmd == '&') {
+ /* safe */
+ (void)strcpy(&with[len], from);
+ len += from_len;
+ continue;
+ }
+ if (*cmd == '\\'
+ && (*(cmd + 1) == delim
+ || *(cmd + 1) == '&'))
+ cmd++;
+ with[len++] = *cmd;
+ }
+ with[len] = '\0';
+ to = with;
+ }
+
+ aptr = _rl_compat_sub(tmp, from, to, g_on);
+ if (aptr) {
+ free(tmp);
+ tmp = aptr;
+ }
+ g_on = 0;
+ }
+ }
+ *result = tmp;
+ return (p_on? 2:1);
+}
+
+
+/*
+ * csh-style history expansion
+ */
+int
+history_expand(char *str, char **output)
+{
+ int ret = 0;
+ size_t idx, i, size;
+ char *tmp, *result;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ if (history_expansion_char == 0) {
+ *output = strdup(str);
+ return(0);
+ }
+
+ *output = NULL;
+ if (str[0] == history_subst_char) {
+ /* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */
+ *output = malloc(strlen(str) + 4 + 1);
+ if (*output == NULL)
+ return 0;
+ (*output)[0] = (*output)[1] = history_expansion_char;
+ (*output)[2] = ':';
+ (*output)[3] = 's';
+ (void)strcpy((*output) + 4, str);
+ str = *output;
+ } else {
+ *output = strdup(str);
+ if (*output == NULL)
+ return 0;
+ }
+
+#define ADD_STRING(what, len, fr) \
+ { \
+ if (idx + len + 1 > size) { \
+ char *nresult = realloc(result, (size += len + 1));\
+ if (nresult == NULL) { \
+ free(*output); \
+ if (/*CONSTCOND*/fr) \
+ free(tmp); \
+ return 0; \
+ } \
+ result = nresult; \
+ } \
+ (void)strncpy(&result[idx], what, len); \
+ idx += len; \
+ result[idx] = '\0'; \
+ }
+
+ result = NULL;
+ size = idx = 0;
+ tmp = NULL;
+ for (i = 0; str[i];) {
+ int qchar, loop_again;
+ size_t len, start, j;
+
+ qchar = 0;
+ loop_again = 1;
+ start = j = i;
+loop:
+ for (; str[j]; j++) {
+ if (str[j] == '\\' &&
+ str[j + 1] == history_expansion_char) {
+ (void)strcpy(&str[j], &str[j + 1]);
+ continue;
+ }
+ if (!loop_again) {
+ if (isspace((unsigned char) str[j])
+ || str[j] == qchar)
+ break;
+ }
+ if (str[j] == history_expansion_char
+ && !strchr(history_no_expand_chars, str[j + 1])
+ && (!history_inhibit_expansion_function ||
+ (*history_inhibit_expansion_function)(str,
+ (int)j) == 0))
+ break;
+ }
+
+ if (str[j] && loop_again) {
+ i = j;
+ qchar = (j > 0 && str[j - 1] == '"' )? '"':0;
+ j++;
+ if (str[j] == history_expansion_char)
+ j++;
+ loop_again = 0;
+ goto loop;
+ }
+ len = i - start;
+ ADD_STRING(&str[start], len, 0);
+
+ if (str[i] == '\0' || str[i] != history_expansion_char) {
+ len = j - i;
+ ADD_STRING(&str[i], len, 0);
+ if (start == 0)
+ ret = 0;
+ else
+ ret = 1;
+ break;
+ }
+ ret = _history_expand_command (str, i, (j - i), &tmp);
+ if (ret > 0 && tmp) {
+ len = strlen(tmp);
+ ADD_STRING(tmp, len, 1);
+ }
+ if (tmp) {
+ free(tmp);
+ tmp = NULL;
+ }
+ i = j;
+ }
+
+ /* ret is 2 for "print only" option */
+ if (ret == 2) {
+ add_history(result);
+#ifdef GDB_411_HACK
+ /* gdb 4.11 has been shipped with readline, where */
+ /* history_expand() returned -1 when the line */
+ /* should not be executed; in readline 2.1+ */
+ /* it should return 2 in such a case */
+ ret = -1;
+#endif
+ }
+ free(*output);
+ *output = result;
+
+ return (ret);
+}
+
+/*
+* Return a string consisting of arguments of "str" from "start" to "end".
+*/
+char *
+history_arg_extract(int start, int end, const char *str)
+{
+ size_t i, len, max;
+ char **arr, *result;
+
+ arr = history_tokenize(str);
+ if (!arr)
+ return(NULL);
+ if (arr && *arr == NULL) {
+ free(arr);
+ return(NULL);
+ }
+
+ for (max = 0; arr[max]; max++)
+ continue;
+ max--;
+
+ if (start == '$')
+ start = max;
+ if (end == '$')
+ end = max;
+ if (end < 0)
+ end = max + end + 1;
+ if (start < 0)
+ start = end;
+
+ if (start < 0 || end < 0 || start > max || end > max || start > end)
+ return(NULL);
+
+ for (i = start, len = 0; i <= end; i++)
+ len += strlen(arr[i]) + 1;
+ len++;
+ result = malloc(len);
+ if (result == NULL)
+ return NULL;
+
+ for (i = start, len = 0; i <= end; i++) {
+ (void)strcpy(result + len, arr[i]);
+ len += strlen(arr[i]);
+ if (i < end)
+ result[len++] = ' ';
+ }
+ result[len] = 0;
+
+ for (i = 0; arr[i]; i++)
+ free(arr[i]);
+ free(arr);
+
+ return(result);
+}
+
+/*
+ * Parse the string into individual tokens,
+ * similar to how shell would do it.
+ */
+char **
+history_tokenize(const char *str)
+{
+ int size = 1, idx = 0, i, start;
+ size_t len;
+ char **result = NULL, *temp, delim = '\0';
+
+ for (i = 0; str[i];) {
+ while (isspace((unsigned char) str[i]))
+ i++;
+ start = i;
+ for (; str[i];) {
+ if (str[i] == '\\') {
+ if (str[i+1] != '\0')
+ i++;
+ } else if (str[i] == delim)
+ delim = '\0';
+ else if (!delim &&
+ (isspace((unsigned char) str[i]) ||
+ strchr("()<>;&|$", str[i])))
+ break;
+ else if (!delim && strchr("'`\"", str[i]))
+ delim = str[i];
+ if (str[i])
+ i++;
+ }
+
+ if (idx + 2 >= size) {
+ char **nresult;
+ size <<= 1;
+ nresult = realloc(result, size * sizeof(char *));
+ if (nresult == NULL) {
+ free(result);
+ return NULL;
+ }
+ result = nresult;
+ }
+ len = i - start;
+ temp = malloc(len + 1);
+ if (temp == NULL) {
+ for (i = 0; i < idx; i++)
+ free(result[i]);
+ free(result);
+ return NULL;
+ }
+ (void)strncpy(temp, &str[start], len);
+ temp[len] = '\0';
+ result[idx++] = temp;
+ result[idx] = NULL;
+ if (str[i])
+ i++;
+ }
+ return (result);
+}
+
+
+/*
+ * limit size of history record to ``max'' events
+ */
+void
+stifle_history(int max)
+{
+ HistEvent ev;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ if (history(h, &ev, H_SETSIZE, max) == 0)
+ max_input_history = max;
+}
+
+
+/*
+ * "unlimit" size of history - set the limit to maximum allowed int value
+ */
+int
+unstifle_history(void)
+{
+ HistEvent ev;
+ int omax;
+
+ history(h, &ev, H_SETSIZE, INT_MAX);
+ omax = max_input_history;
+ max_input_history = INT_MAX;
+ return (omax); /* some value _must_ be returned */
+}
+
+
+int
+history_is_stifled(void)
+{
+
+ /* cannot return true answer */
+ return (max_input_history != INT_MAX);
+}
+
+
+/*
+ * read history from a file given
+ */
+int
+read_history(const char *filename)
+{
+ HistEvent ev;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+ return (history(h, &ev, H_LOAD, filename) == -1);
+}
+
+
+/*
+ * write history to a file given
+ */
+int
+write_history(const char *filename)
+{
+ HistEvent ev;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+ return (history(h, &ev, H_SAVE, filename) == -1);
+}
+
+
+/*
+ * returns history ``num''th event
+ *
+ * returned pointer points to static variable
+ */
+HIST_ENTRY *
+history_get(int num)
+{
+ static HIST_ENTRY she;
+ HistEvent ev;
+ int curr_num;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ /* save current position */
+ if (history(h, &ev, H_CURR) != 0)
+ return (NULL);
+ curr_num = ev.num;
+
+ /* start from most recent */
+ if (history(h, &ev, H_FIRST) != 0)
+ return (NULL); /* error */
+
+ /* look backwards for event matching specified offset */
+ if (history(h, &ev, H_NEXT_EVENT, num))
+ return (NULL);
+
+ she.line = ev.str;
+ she.data = NULL;
+
+ /* restore pointer to where it was */
+ (void)history(h, &ev, H_SET, curr_num);
+
+ return (&she);
+}
+
+
+/*
+ * add the line to history table
+ */
+int
+add_history(const char *line)
+{
+ HistEvent ev;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ (void)history(h, &ev, H_ENTER, line);
+ if (history(h, &ev, H_GETSIZE) == 0)
+ history_length = ev.num;
+
+ return (!(history_length > 0)); /* return 0 if all is okay */
+}
+
+
+/*
+ * remove the specified entry from the history list and return it.
+ */
+HIST_ENTRY *
+remove_history(int num)
+{
+ static HIST_ENTRY she;
+ HistEvent ev;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ if (history(h, &ev, H_DEL, num) != 0)
+ return NULL;
+
+ she.line = ev.str;
+ she.data = NULL;
+
+ return &she;
+}
+
+
+/*
+ * clear the history list - delete all entries
+ */
+void
+clear_history(void)
+{
+ HistEvent ev;
+
+ history(h, &ev, H_CLEAR);
+}
+
+
+/*
+ * returns offset of the current history event
+ */
+int
+where_history(void)
+{
+ HistEvent ev;
+ int curr_num, off;
+
+ if (history(h, &ev, H_CURR) != 0)
+ return (0);
+ curr_num = ev.num;
+
+ history(h, &ev, H_FIRST);
+ off = 1;
+ while (ev.num != curr_num && history(h, &ev, H_NEXT) == 0)
+ off++;
+
+ return (off);
+}
+
+
+/*
+ * returns current history event or NULL if there is no such event
+ */
+HIST_ENTRY *
+current_history(void)
+{
+
+ return (_move_history(H_CURR));
+}
+
+
+/*
+ * returns total number of bytes history events' data are using
+ */
+int
+history_total_bytes(void)
+{
+ HistEvent ev;
+ int curr_num, size;
+
+ if (history(h, &ev, H_CURR) != 0)
+ return (-1);
+ curr_num = ev.num;
+
+ history(h, &ev, H_FIRST);
+ size = 0;
+ do
+ size += strlen(ev.str);
+ while (history(h, &ev, H_NEXT) == 0);
+
+ /* get to the same position as before */
+ history(h, &ev, H_PREV_EVENT, curr_num);
+
+ return (size);
+}
+
+
+/*
+ * sets the position in the history list to ``pos''
+ */
+int
+history_set_pos(int pos)
+{
+ HistEvent ev;
+ int curr_num;
+
+ if (pos > history_length || pos < 0)
+ return (-1);
+
+ history(h, &ev, H_CURR);
+ curr_num = ev.num;
+
+ if (history(h, &ev, H_SET, pos)) {
+ history(h, &ev, H_SET, curr_num);
+ return(-1);
+ }
+ return (0);
+}
+
+
+/*
+ * returns previous event in history and shifts pointer accordingly
+ */
+HIST_ENTRY *
+previous_history(void)
+{
+
+ return (_move_history(H_PREV));
+}
+
+
+/*
+ * returns next event in history and shifts pointer accordingly
+ */
+HIST_ENTRY *
+next_history(void)
+{
+
+ return (_move_history(H_NEXT));
+}
+
+
+/*
+ * searches for first history event containing the str
+ */
+int
+history_search(const char *str, int direction)
+{
+ HistEvent ev;
+ const char *strp;
+ int curr_num;
+
+ if (history(h, &ev, H_CURR) != 0)
+ return (-1);
+ curr_num = ev.num;
+
+ for (;;) {
+ if ((strp = strstr(ev.str, str)) != NULL)
+ return (int) (strp - ev.str);
+ if (history(h, &ev, direction < 0 ? H_NEXT:H_PREV) != 0)
+ break;
+ }
+ history(h, &ev, H_SET, curr_num);
+ return (-1);
+}
+
+
+/*
+ * searches for first history event beginning with str
+ */
+int
+history_search_prefix(const char *str, int direction)
+{
+ HistEvent ev;
+
+ return (history(h, &ev, direction < 0? H_PREV_STR:H_NEXT_STR, str));
+}
+
+
+/*
+ * search for event in history containing str, starting at offset
+ * abs(pos); continue backward, if pos<0, forward otherwise
+ */
+/* ARGSUSED */
+int
+history_search_pos(const char *str,
+ int direction __attribute__((__unused__)), int pos)
+{
+ HistEvent ev;
+ int curr_num, off;
+
+ off = (pos > 0) ? pos : -pos;
+ pos = (pos > 0) ? 1 : -1;
+
+ if (history(h, &ev, H_CURR) != 0)
+ return (-1);
+ curr_num = ev.num;
+
+ if (history_set_pos(off) != 0 || history(h, &ev, H_CURR) != 0)
+ return (-1);
+
+
+ for (;;) {
+ if (strstr(ev.str, str))
+ return (off);
+ if (history(h, &ev, (pos < 0) ? H_PREV : H_NEXT) != 0)
+ break;
+ }
+
+ /* set "current" pointer back to previous state */
+ history(h, &ev, (pos < 0) ? H_NEXT_EVENT : H_PREV_EVENT, curr_num);
+
+ return (-1);
+}
+
+
+/********************************/
+/* completion functions */
+
+char *
+tilde_expand(char *name)
+{
+ return fn_tilde_expand(name);
+}
+
+char *
+filename_completion_function(const char *name, int state)
+{
+ return fn_filename_completion_function(name, state);
+}
+
+/*
+ * a completion generator for usernames; returns _first_ username
+ * which starts with supplied text
+ * text contains a partial username preceded by random character
+ * (usually '~'); state is ignored
+ * it's callers responsibility to free returned value
+ */
+char *
+username_completion_function(const char *text, int state)
+{
+ struct passwd *pwd;
+
+ if (text[0] == '\0')
+ return (NULL);
+
+ if (*text == '~')
+ text++;
+
+ if (state == 0)
+ setpwent();
+
+ while ((pwd = getpwent())
+ && pwd != NULL && text[0] == pwd->pw_name[0]
+ && strcmp(text, pwd->pw_name) == 0);
+
+ if (pwd == NULL) {
+ endpwent();
+ return (NULL);
+ }
+ return (strdup(pwd->pw_name));
+}
+
+
+/*
+ * el-compatible wrapper to send TSTP on ^Z
+ */
+/* ARGSUSED */
+static unsigned char
+_el_rl_tstp(EditLine *el __attribute__((__unused__)), int ch __attribute__((__unused__)))
+{
+ (void)kill(0, SIGTSTP);
+ return CC_NORM;
+}
+
+/*
+ * Display list of strings in columnar format on readline's output stream.
+ * 'matches' is list of strings, 'len' is number of strings in 'matches',
+ * 'max' is maximum length of string in 'matches'.
+ */
+void
+rl_display_match_list(char **matches, int len, int max)
+{
+
+ fn_display_match_list(e, matches, len, max);
+}
+
+static const char *
+/*ARGSUSED*/
+_rl_completion_append_character_function(const char *dummy
+ __attribute__((__unused__)))
+{
+ static char buf[2];
+ buf[1] = rl_completion_append_character;
+ return buf;
+}
+
+
+/*
+ * complete word at current point
+ */
+/* ARGSUSED */
+int
+rl_complete(int ignore __attribute__((__unused__)), int invoking_key)
+{
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ if (rl_inhibit_completion) {
+ char arr[2];
+ arr[0] = (char)invoking_key;
+ arr[1] = '\0';
+ el_insertstr(e, arr);
+ return (CC_REFRESH);
+ }
+
+ /* Just look at how many global variables modify this operation! */
+ return fn_complete(e,
+ (CPFunction *)rl_completion_entry_function,
+ rl_attempted_completion_function,
+ rl_basic_word_break_characters, rl_special_prefixes,
+ _rl_completion_append_character_function, rl_completion_query_items,
+ &rl_completion_type, &rl_attempted_completion_over,
+ &rl_point, &rl_end);
+}
+
+
+/* ARGSUSED */
+static unsigned char
+_el_rl_complete(EditLine *el __attribute__((__unused__)), int ch)
+{
+ return (unsigned char)rl_complete(0, ch);
+}
+
+/*
+ * misc other functions
+ */
+
+/*
+ * bind key c to readline-type function func
+ */
+int
+rl_bind_key(int c, int func(int, int))
+{
+ int retval = -1;
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ if (func == rl_insert) {
+ /* XXX notice there is no range checking of ``c'' */
+ e->el_map.key[c] = ED_INSERT;
+ retval = 0;
+ }
+ return (retval);
+}
+
+
+/*
+ * read one key from input - handles chars pushed back
+ * to input stream also
+ */
+int
+rl_read_key(void)
+{
+ char fooarr[2 * sizeof(int)];
+
+ if (e == NULL || h == NULL)
+ rl_initialize();
+
+ return (el_getc(e, fooarr));
+}
+
+
+/*
+ * reset the terminal
+ */
+/* ARGSUSED */
+void
+rl_reset_terminal(const char *p __attribute__((__unused__)))
+{
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+ el_reset(e);
+}
+
+
+/*
+ * insert character ``c'' back into input stream, ``count'' times
+ */
+int
+rl_insert(int count, int c)
+{
+ char arr[2];
+
+ if (h == NULL || e == NULL)
+ rl_initialize();
+
+ /* XXX - int -> char conversion can lose on multichars */
+ arr[0] = c;
+ arr[1] = '\0';
+
+ for (; count > 0; count--)
+ el_push(e, arr);
+
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+rl_newline(int count, int c)
+{
+ /*
+ * Readline-4.0 appears to ignore the args.
+ */
+ return rl_insert(1, '\n');
+}
+
+/*ARGSUSED*/
+static unsigned char
+rl_bind_wrapper(EditLine *el, unsigned char c)
+{
+ if (map[c] == NULL)
+ return CC_ERROR;
+
+ _rl_update_pos();
+
+ (*map[c])(NULL, c);
+
+ /* If rl_done was set by the above call, deal with it here */
+ if (rl_done)
+ return CC_EOF;
+
+ return CC_NORM;
+}
+
+int
+rl_add_defun(const char *name, Function *fun, int c)
+{
+ char dest[8];
+ if (c >= sizeof(map) / sizeof(map[0]) || c < 0)
+ return -1;
+ map[(unsigned char)c] = fun;
+ el_set(e, EL_ADDFN, name, name, rl_bind_wrapper);
+ vis(dest, c, VIS_WHITE|VIS_NOSLASH, 0);
+ el_set(e, EL_BIND, dest, name);
+ return 0;
+}
+
+void
+rl_callback_read_char()
+{
+ int count = 0, done = 0;
+ const char *buf = el_gets(e, &count);
+ char *wbuf;
+
+ if (buf == NULL || count-- <= 0)
+ return;
+ if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF])
+ done = 1;
+ if (buf[count] == '\n' || buf[count] == '\r')
+ done = 2;
+
+ if (done && rl_linefunc != NULL) {
+ el_set(e, EL_UNBUFFERED, 0);
+ if (done == 2) {
+ if ((wbuf = strdup(buf)) != NULL)
+ wbuf[count] = '\0';
+ } else
+ wbuf = NULL;
+ (*(void (*)(const char *))rl_linefunc)(wbuf);
+ el_set(e, EL_UNBUFFERED, 1);
+ }
+}
+
+void
+rl_callback_handler_install (const char *prompt, VCPFunction *linefunc)
+{
+ if (e == NULL) {
+ rl_initialize();
+ }
+ if (rl_prompt)
+ free(rl_prompt);
+ rl_prompt = prompt ? strdup(strchr(prompt, *prompt)) : NULL;
+ rl_linefunc = linefunc;
+ el_set(e, EL_UNBUFFERED, 1);
+}
+
+void
+rl_callback_handler_remove(void)
+{
+ el_set(e, EL_UNBUFFERED, 0);
+}
+
+void
+rl_redisplay(void)
+{
+ char a[2];
+ a[0] = e->el_tty.t_c[TS_IO][C_REPRINT];
+ a[1] = '\0';
+ el_push(e, a);
+}
+
+int
+rl_get_previous_history(int count, int key)
+{
+ char a[2];
+ a[0] = key;
+ a[1] = '\0';
+ while (count--)
+ el_push(e, a);
+ return 0;
+}
+
+void
+/*ARGSUSED*/
+rl_prep_terminal(int meta_flag)
+{
+ el_set(e, EL_PREP_TERM, 1);
+}
+
+void
+rl_deprep_terminal(void)
+{
+ el_set(e, EL_PREP_TERM, 0);
+}
+
+int
+rl_read_init_file(const char *s)
+{
+ return(el_source(e, s));
+}
+
+int
+rl_parse_and_bind(const char *line)
+{
+ const char **argv;
+ int argc;
+ Tokenizer *tok;
+
+ tok = tok_init(NULL);
+ tok_str(tok, line, &argc, &argv);
+ argc = el_parse(e, argc, argv);
+ tok_end(tok);
+ return (argc ? 1 : 0);
+}
+
+int
+rl_variable_bind(const char *var, const char *value)
+{
+ /*
+ * The proper return value is undocument, but this is what the
+ * readline source seems to do.
+ */
+ return ((el_set(e, EL_BIND, "", var, value) == -1) ? 1 : 0);
+}
+
+void
+rl_stuff_char(int c)
+{
+ char buf[2];
+
+ buf[0] = c;
+ buf[1] = '\0';
+ el_insertstr(e, buf);
+}
+
+static int
+_rl_event_read_char(EditLine *el, char *cp)
+{
+ int n, num_read = 0;
+
+ *cp = 0;
+ while (rl_event_hook) {
+
+ (*rl_event_hook)();
+
+#if defined(FIONREAD)
+ if (ioctl(el->el_infd, FIONREAD, &n) < 0)
+ return(-1);
+ if (n)
+ num_read = read(el->el_infd, cp, 1);
+ else
+ num_read = 0;
+#elif defined(F_SETFL) && defined(O_NDELAY)
+ if ((n = fcntl(el->el_infd, F_GETFL, 0)) < 0)
+ return(-1);
+ if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0)
+ return(-1);
+ num_read = read(el->el_infd, cp, 1);
+ if (fcntl(el->el_infd, F_SETFL, n))
+ return(-1);
+#else
+ /* not non-blocking, but what you gonna do? */
+ num_read = read(el->el_infd, cp, 1);
+ return(-1);
+#endif
+
+ if (num_read < 0 && errno == EAGAIN)
+ continue;
+ if (num_read == 0)
+ continue;
+ break;
+ }
+ if (!rl_event_hook)
+ el_set(el, EL_GETCFN, EL_BUILTIN_GETCFN);
+ return(num_read);
+}
+
+static void
+_rl_update_pos(void)
+{
+ const LineInfo *li = el_line(e);
+
+ rl_point = li->cursor - li->buffer;
+ rl_end = li->lastchar - li->buffer;
+}
diff --git a/frontend/libedit/readline.h b/frontend/libedit/readline.h
new file mode 100644
index 0000000..769d0af
--- /dev/null
+++ b/frontend/libedit/readline.h
@@ -0,0 +1,193 @@
+/* $NetBSD: readline.h,v 1.18 2006/08/21 12:45:30 christos Exp $ */
+
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jaromir Dolecek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _READLINE_H_
+#define _READLINE_H_
+
+#include <sys/types.h>
+
+/* list of readline stuff supported by editline library's readline wrapper */
+
+/* typedefs */
+typedef int Function(const char *, int);
+typedef void VFunction(void);
+typedef void VCPFunction(char *);
+typedef char *CPFunction(const char *, int);
+typedef char **CPPFunction(const char *, int, int);
+
+typedef void *histdata_t;
+
+typedef struct _hist_entry {
+ const char *line;
+ histdata_t *data;
+} HIST_ENTRY;
+
+typedef struct _keymap_entry {
+ char type;
+#define ISFUNC 0
+#define ISKMAP 1
+#define ISMACR 2
+ Function *function;
+} KEYMAP_ENTRY;
+
+#define KEYMAP_SIZE 256
+
+typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
+typedef KEYMAP_ENTRY *Keymap;
+
+#define control_character_threshold 0x20
+#define control_character_bit 0x40
+
+#ifndef CTRL
+#include <sys/ioctl.h>
+#ifdef __GLIBC__
+#include <sys/ttydefaults.h>
+#endif
+#ifndef CTRL
+#define CTRL(c) ((c) & 037)
+#endif
+#endif
+#ifndef UNCTRL
+#define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit)
+#endif
+
+#define RUBOUT 0x7f
+#define ABORT_CHAR CTRL('G')
+
+/* global variables used by readline enabled applications */
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern const char *rl_library_version;
+extern char *rl_readline_name;
+extern FILE *rl_instream;
+extern FILE *rl_outstream;
+extern char *rl_line_buffer;
+extern int rl_point, rl_end;
+extern int history_base, history_length;
+extern int max_input_history;
+extern char *rl_basic_word_break_characters;
+extern char *rl_completer_word_break_characters;
+extern char *rl_completer_quote_characters;
+extern Function *rl_completion_entry_function;
+extern CPPFunction *rl_attempted_completion_function;
+extern int rl_attempted_completion_over;
+extern int rl_completion_type;
+extern int rl_completion_query_items;
+extern char *rl_special_prefixes;
+extern int rl_completion_append_character;
+extern int rl_inhibit_completion;
+extern Function *rl_pre_input_hook;
+extern Function *rl_startup_hook;
+extern char *rl_terminal_name;
+extern int rl_already_prompted;
+extern char *rl_prompt;
+/*
+ * The following is not implemented
+ */
+extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
+ emacs_meta_keymap,
+ emacs_ctlx_keymap;
+extern int rl_filename_completion_desired;
+extern int rl_ignore_completion_duplicates;
+extern Function *rl_getc_function;
+extern VFunction *rl_redisplay_function;
+extern VFunction *rl_completion_display_matches_hook;
+extern VFunction *rl_prep_term_function;
+extern VFunction *rl_deprep_term_function;
+
+/* supported functions */
+char *readline(const char *);
+int rl_initialize(void);
+
+void using_history(void);
+int add_history(const char *);
+void clear_history(void);
+void stifle_history(int);
+int unstifle_history(void);
+int history_is_stifled(void);
+int where_history(void);
+HIST_ENTRY *current_history(void);
+HIST_ENTRY *history_get(int);
+HIST_ENTRY *remove_history(int);
+int history_total_bytes(void);
+int history_set_pos(int);
+HIST_ENTRY *previous_history(void);
+HIST_ENTRY *next_history(void);
+int history_search(const char *, int);
+int history_search_prefix(const char *, int);
+int history_search_pos(const char *, int, int);
+int read_history(const char *);
+int write_history(const char *);
+int history_expand(char *, char **);
+char **history_tokenize(const char *);
+const char *get_history_event(const char *, int *, int);
+char *history_arg_extract(int, int, const char *);
+
+char *tilde_expand(char *);
+char *filename_completion_function(const char *, int);
+char *username_completion_function(const char *, int);
+int rl_complete(int, int);
+int rl_read_key(void);
+char **completion_matches(const char *, CPFunction *);
+void rl_display_match_list(char **, int, int);
+
+int rl_insert(int, int);
+void rl_reset_terminal(const char *);
+int rl_bind_key(int, int (*)(int, int));
+int rl_newline(int, int);
+void rl_callback_read_char(void);
+void rl_callback_handler_install(const char *, VCPFunction *);
+void rl_callback_handler_remove(void);
+void rl_redisplay(void);
+int rl_get_previous_history(int, int);
+void rl_prep_terminal(int);
+void rl_deprep_terminal(void);
+int rl_read_init_file(const char *);
+int rl_parse_and_bind(const char *);
+int rl_variable_bind(const char *, const char *);
+void rl_stuff_char(int);
+int rl_add_defun(const char *, Function *, int);
+
+/*
+ * The following are not implemented
+ */
+Keymap rl_get_keymap(void);
+Keymap rl_make_bare_keymap(void);
+int rl_generic_bind(int, const char *, const char *, Keymap);
+int rl_bind_key_in_map(int, Function *, Keymap);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _READLINE_H_ */
diff --git a/frontend/libedit/refresh.c b/frontend/libedit/refresh.c
new file mode 100644
index 0000000..f627075
--- /dev/null
+++ b/frontend/libedit/refresh.c
@@ -0,0 +1,1133 @@
+/* $NetBSD: refresh.c,v 1.27 2005/11/09 22:11:10 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * refresh.c: Lower level screen refreshing functions
+ */
+#include <stdio.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "el.h"
+
+private void re_addc(EditLine *, int);
+private void re_update_line(EditLine *, char *, char *, int);
+private void re_insert (EditLine *, char *, int, int, char *, int);
+private void re_delete(EditLine *, char *, int, int, int);
+private void re_fastputc(EditLine *, int);
+private void re_clear_eol(EditLine *, int, int, int);
+private void re__strncopy(char *, char *, size_t);
+private void re__copy_and_pad(char *, const char *, size_t);
+
+#ifdef DEBUG_REFRESH
+private void re_printstr(EditLine *, const char *, char *, char *);
+#define __F el->el_errfile
+#define ELRE_ASSERT(a, b, c) do \
+ if (/*CONSTCOND*/ a) { \
+ (void) fprintf b; \
+ c; \
+ } \
+ while (/*CONSTCOND*/0)
+#define ELRE_DEBUG(a, b) ELRE_ASSERT(a,b,;)
+
+/* re_printstr():
+ * Print a string on the debugging pty
+ */
+private void
+re_printstr(EditLine *el, const char *str, char *f, char *t)
+{
+
+ ELRE_DEBUG(1, (__F, "%s:\"", str));
+ while (f < t)
+ ELRE_DEBUG(1, (__F, "%c", *f++ & 0177));
+ ELRE_DEBUG(1, (__F, "\"\r\n"));
+}
+#else
+#define ELRE_ASSERT(a, b, c)
+#define ELRE_DEBUG(a, b)
+#endif
+
+
+/* re_addc():
+ * Draw c, expanding tabs, control chars etc.
+ */
+private void
+re_addc(EditLine *el, int c)
+{
+
+ if (isprint(c)) {
+ re_putc(el, c, 1);
+ return;
+ }
+ if (c == '\n') { /* expand the newline */
+ int oldv = el->el_refresh.r_cursor.v;
+ re_putc(el, '\0', 0); /* assure end of line */
+ if (oldv == el->el_refresh.r_cursor.v) { /* XXX */
+ el->el_refresh.r_cursor.h = 0; /* reset cursor pos */
+ el->el_refresh.r_cursor.v++;
+ }
+ return;
+ }
+ if (c == '\t') { /* expand the tab */
+ for (;;) {
+ re_putc(el, ' ', 1);
+ if ((el->el_refresh.r_cursor.h & 07) == 0)
+ break; /* go until tab stop */
+ }
+ } else if (iscntrl(c)) {
+ re_putc(el, '^', 1);
+ if (c == '\177')
+ re_putc(el, '?', 1);
+ else
+ /* uncontrolify it; works only for iso8859-1 like sets */
+ re_putc(el, (c | 0100), 1);
+ } else {
+ re_putc(el, '\\', 1);
+ re_putc(el, (int) ((((unsigned int) c >> 6) & 07) + '0'), 1);
+ re_putc(el, (int) ((((unsigned int) c >> 3) & 07) + '0'), 1);
+ re_putc(el, (c & 07) + '0', 1);
+ }
+}
+
+
+/* re_putc():
+ * Draw the character given
+ */
+protected void
+re_putc(EditLine *el, int c, int shift)
+{
+
+ ELRE_DEBUG(1, (__F, "printing %3.3o '%c'\r\n", c, c));
+
+ el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c;
+ if (!shift)
+ return;
+
+ el->el_refresh.r_cursor.h++; /* advance to next place */
+ if (el->el_refresh.r_cursor.h >= el->el_term.t_size.h) {
+ el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_term.t_size.h] = '\0';
+ /* assure end of line */
+ el->el_refresh.r_cursor.h = 0; /* reset it. */
+
+ /*
+ * If we would overflow (input is longer than terminal size),
+ * emulate scroll by dropping first line and shuffling the rest.
+ * We do this via pointer shuffling - it's safe in this case
+ * and we avoid memcpy().
+ */
+ if (el->el_refresh.r_cursor.v + 1 >= el->el_term.t_size.v) {
+ int i, lins = el->el_term.t_size.v;
+ char *firstline = el->el_vdisplay[0];
+
+ for(i=1; i < lins; i++)
+ el->el_vdisplay[i-1] = el->el_vdisplay[i];
+
+ firstline[0] = '\0'; /* empty the string */
+ el->el_vdisplay[i-1] = firstline;
+ } else
+ el->el_refresh.r_cursor.v++;
+
+ ELRE_ASSERT(el->el_refresh.r_cursor.v >= el->el_term.t_size.v,
+ (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n",
+ el->el_refresh.r_cursor.v, el->el_term.t_size.v),
+ abort());
+ }
+}
+
+
+/* re_refresh():
+ * draws the new virtual screen image from the current input
+ * line, then goes line-by-line changing the real image to the new
+ * virtual image. The routine to re-draw a line can be replaced
+ * easily in hopes of a smarter one being placed there.
+ */
+protected void
+re_refresh(EditLine *el)
+{
+ int i, rhdiff;
+ char *cp, *st;
+ coord_t cur;
+#ifdef notyet
+ size_t termsz;
+#endif
+
+ ELRE_DEBUG(1, (__F, "el->el_line.buffer = :%s:\r\n",
+ el->el_line.buffer));
+
+ /* reset the Drawing cursor */
+ el->el_refresh.r_cursor.h = 0;
+ el->el_refresh.r_cursor.v = 0;
+
+ /* temporarily draw rprompt to calculate its size */
+ prompt_print(el, EL_RPROMPT);
+
+ /* reset the Drawing cursor */
+ el->el_refresh.r_cursor.h = 0;
+ el->el_refresh.r_cursor.v = 0;
+
+ if (el->el_line.cursor >= el->el_line.lastchar) {
+ if (el->el_map.current == el->el_map.alt
+ && el->el_line.lastchar != el->el_line.buffer)
+ el->el_line.cursor = el->el_line.lastchar - 1;
+ else
+ el->el_line.cursor = el->el_line.lastchar;
+ }
+
+ cur.h = -1; /* set flag in case I'm not set */
+ cur.v = 0;
+
+ prompt_print(el, EL_PROMPT);
+
+ /* draw the current input buffer */
+#if notyet
+ termsz = el->el_term.t_size.h * el->el_term.t_size.v;
+ if (el->el_line.lastchar - el->el_line.buffer > termsz) {
+ /*
+ * If line is longer than terminal, process only part
+ * of line which would influence display.
+ */
+ size_t rem = (el->el_line.lastchar-el->el_line.buffer)%termsz;
+
+ st = el->el_line.lastchar - rem
+ - (termsz - (((rem / el->el_term.t_size.v) - 1)
+ * el->el_term.t_size.v));
+ } else
+#endif
+ st = el->el_line.buffer;
+
+ for (cp = st; cp < el->el_line.lastchar; cp++) {
+ if (cp == el->el_line.cursor) {
+ /* save for later */
+ cur.h = el->el_refresh.r_cursor.h;
+ cur.v = el->el_refresh.r_cursor.v;
+ }
+ re_addc(el, (unsigned char) *cp);
+ }
+
+ if (cur.h == -1) { /* if I haven't been set yet, I'm at the end */
+ cur.h = el->el_refresh.r_cursor.h;
+ cur.v = el->el_refresh.r_cursor.v;
+ }
+ rhdiff = el->el_term.t_size.h - el->el_refresh.r_cursor.h -
+ el->el_rprompt.p_pos.h;
+ if (el->el_rprompt.p_pos.h && !el->el_rprompt.p_pos.v &&
+ !el->el_refresh.r_cursor.v && rhdiff > 1) {
+ /*
+ * have a right-hand side prompt that will fit
+ * on the end of the first line with at least
+ * one character gap to the input buffer.
+ */
+ while (--rhdiff > 0) /* pad out with spaces */
+ re_putc(el, ' ', 1);
+ prompt_print(el, EL_RPROMPT);
+ } else {
+ el->el_rprompt.p_pos.h = 0; /* flag "not using rprompt" */
+ el->el_rprompt.p_pos.v = 0;
+ }
+
+ re_putc(el, '\0', 0); /* make line ended with NUL, no cursor shift */
+
+ el->el_refresh.r_newcv = el->el_refresh.r_cursor.v;
+
+ ELRE_DEBUG(1, (__F,
+ "term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n",
+ el->el_term.t_size.h, el->el_refresh.r_cursor.h,
+ el->el_refresh.r_cursor.v, el->el_vdisplay[0]));
+
+ ELRE_DEBUG(1, (__F, "updating %d lines.\r\n", el->el_refresh.r_newcv));
+ for (i = 0; i <= el->el_refresh.r_newcv; i++) {
+ /* NOTE THAT re_update_line MAY CHANGE el_display[i] */
+ re_update_line(el, el->el_display[i], el->el_vdisplay[i], i);
+
+ /*
+ * Copy the new line to be the current one, and pad out with
+ * spaces to the full width of the terminal so that if we try
+ * moving the cursor by writing the character that is at the
+ * end of the screen line, it won't be a NUL or some old
+ * leftover stuff.
+ */
+ re__copy_and_pad(el->el_display[i], el->el_vdisplay[i],
+ (size_t) el->el_term.t_size.h);
+ }
+ ELRE_DEBUG(1, (__F,
+ "\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n",
+ el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i));
+
+ if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv)
+ for (; i <= el->el_refresh.r_oldcv; i++) {
+ term_move_to_line(el, i);
+ term_move_to_char(el, 0);
+ term_clear_EOL(el, (int) strlen(el->el_display[i]));
+#ifdef DEBUG_REFRESH
+ term_overwrite(el, "C\b", 2);
+#endif /* DEBUG_REFRESH */
+ el->el_display[i][0] = '\0';
+ }
+
+ el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */
+ ELRE_DEBUG(1, (__F,
+ "\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n",
+ el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v,
+ cur.h, cur.v));
+ term_move_to_line(el, cur.v); /* go to where the cursor is */
+ term_move_to_char(el, cur.h);
+}
+
+
+/* re_goto_bottom():
+ * used to go to last used screen line
+ */
+protected void
+re_goto_bottom(EditLine *el)
+{
+
+ term_move_to_line(el, el->el_refresh.r_oldcv);
+ term__putc('\n');
+ re_clear_display(el);
+ term__flush();
+}
+
+
+/* re_insert():
+ * insert num characters of s into d (in front of the character)
+ * at dat, maximum length of d is dlen
+ */
+private void
+/*ARGSUSED*/
+re_insert(EditLine *el __attribute__((__unused__)),
+ char *d, int dat, int dlen, char *s, int num)
+{
+ char *a, *b;
+
+ if (num <= 0)
+ return;
+ if (num > dlen - dat)
+ num = dlen - dat;
+
+ ELRE_DEBUG(1,
+ (__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
+ num, dat, dlen, d));
+ ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
+
+ /* open up the space for num chars */
+ if (num > 0) {
+ b = d + dlen - 1;
+ a = b - num;
+ while (a >= &d[dat])
+ *b-- = *a--;
+ d[dlen] = '\0'; /* just in case */
+ }
+ ELRE_DEBUG(1, (__F,
+ "re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
+ num, dat, dlen, d));
+ ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
+
+ /* copy the characters */
+ for (a = d + dat; (a < d + dlen) && (num > 0); num--)
+ *a++ = *s++;
+
+ ELRE_DEBUG(1,
+ (__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
+ num, dat, dlen, d, s));
+ ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
+}
+
+
+/* re_delete():
+ * delete num characters d at dat, maximum length of d is dlen
+ */
+private void
+/*ARGSUSED*/
+re_delete(EditLine *el __attribute__((__unused__)),
+ char *d, int dat, int dlen, int num)
+{
+ char *a, *b;
+
+ if (num <= 0)
+ return;
+ if (dat + num >= dlen) {
+ d[dat] = '\0';
+ return;
+ }
+ ELRE_DEBUG(1,
+ (__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n",
+ num, dat, dlen, d));
+
+ /* open up the space for num chars */
+ if (num > 0) {
+ b = d + dat;
+ a = b + num;
+ while (a < &d[dlen])
+ *b++ = *a++;
+ d[dlen] = '\0'; /* just in case */
+ }
+ ELRE_DEBUG(1,
+ (__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n",
+ num, dat, dlen, d));
+}
+
+
+/* re__strncopy():
+ * Like strncpy without padding.
+ */
+private void
+re__strncopy(char *a, char *b, size_t n)
+{
+
+ while (n-- && *b)
+ *a++ = *b++;
+}
+
+/* re_clear_eol():
+ * Find the number of characters we need to clear till the end of line
+ * in order to make sure that we have cleared the previous contents of
+ * the line. fx and sx is the number of characters inserted or deleted
+ * int the first or second diff, diff is the difference between the
+ * number of characters between the new and old line.
+ */
+private void
+re_clear_eol(EditLine *el, int fx, int sx, int diff)
+{
+
+ ELRE_DEBUG(1, (__F, "re_clear_eol sx %d, fx %d, diff %d\n",
+ sx, fx, diff));
+
+ if (fx < 0)
+ fx = -fx;
+ if (sx < 0)
+ sx = -sx;
+ if (fx > diff)
+ diff = fx;
+ if (sx > diff)
+ diff = sx;
+
+ ELRE_DEBUG(1, (__F, "re_clear_eol %d\n", diff));
+ term_clear_EOL(el, diff);
+}
+
+/*****************************************************************
+ re_update_line() is based on finding the middle difference of each line
+ on the screen; vis:
+
+ /old first difference
+ /beginning of line | /old last same /old EOL
+ v v v v
+old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as
+new: eddie> Oh, my little buggy says to me, as lurgid as
+ ^ ^ ^ ^
+ \beginning of line | \new last same \new end of line
+ \new first difference
+
+ all are character pointers for the sake of speed. Special cases for
+ no differences, as well as for end of line additions must be handled.
+**************************************************************** */
+
+/* Minimum at which doing an insert it "worth it". This should be about
+ * half the "cost" of going into insert mode, inserting a character, and
+ * going back out. This should really be calculated from the termcap
+ * data... For the moment, a good number for ANSI terminals.
+ */
+#define MIN_END_KEEP 4
+
+private void
+re_update_line(EditLine *el, char *old, char *new, int i)
+{
+ char *o, *n, *p, c;
+ char *ofd, *ols, *oe, *nfd, *nls, *ne;
+ char *osb, *ose, *nsb, *nse;
+ int fx, sx;
+
+ /*
+ * find first diff
+ */
+ for (o = old, n = new; *o && (*o == *n); o++, n++)
+ continue;
+ ofd = o;
+ nfd = n;
+
+ /*
+ * Find the end of both old and new
+ */
+ while (*o)
+ o++;
+ /*
+ * Remove any trailing blanks off of the end, being careful not to
+ * back up past the beginning.
+ */
+ while (ofd < o) {
+ if (o[-1] != ' ')
+ break;
+ o--;
+ }
+ oe = o;
+ *oe = '\0';
+
+ while (*n)
+ n++;
+
+ /* remove blanks from end of new */
+ while (nfd < n) {
+ if (n[-1] != ' ')
+ break;
+ n--;
+ }
+ ne = n;
+ *ne = '\0';
+
+ /*
+ * if no diff, continue to next line of redraw
+ */
+ if (*ofd == '\0' && *nfd == '\0') {
+ ELRE_DEBUG(1, (__F, "no difference.\r\n"));
+ return;
+ }
+ /*
+ * find last same pointer
+ */
+ while ((o > ofd) && (n > nfd) && (*--o == *--n))
+ continue;
+ ols = ++o;
+ nls = ++n;
+
+ /*
+ * find same begining and same end
+ */
+ osb = ols;
+ nsb = nls;
+ ose = ols;
+ nse = nls;
+
+ /*
+ * case 1: insert: scan from nfd to nls looking for *ofd
+ */
+ if (*ofd) {
+ for (c = *ofd, n = nfd; n < nls; n++) {
+ if (c == *n) {
+ for (o = ofd, p = n;
+ p < nls && o < ols && *o == *p;
+ o++, p++)
+ continue;
+ /*
+ * if the new match is longer and it's worth
+ * keeping, then we take it
+ */
+ if (((nse - nsb) < (p - n)) &&
+ (2 * (p - n) > n - nfd)) {
+ nsb = n;
+ nse = p;
+ osb = ofd;
+ ose = o;
+ }
+ }
+ }
+ }
+ /*
+ * case 2: delete: scan from ofd to ols looking for *nfd
+ */
+ if (*nfd) {
+ for (c = *nfd, o = ofd; o < ols; o++) {
+ if (c == *o) {
+ for (n = nfd, p = o;
+ p < ols && n < nls && *p == *n;
+ p++, n++)
+ continue;
+ /*
+ * if the new match is longer and it's worth
+ * keeping, then we take it
+ */
+ if (((ose - osb) < (p - o)) &&
+ (2 * (p - o) > o - ofd)) {
+ nsb = nfd;
+ nse = n;
+ osb = o;
+ ose = p;
+ }
+ }
+ }
+ }
+ /*
+ * Pragmatics I: If old trailing whitespace or not enough characters to
+ * save to be worth it, then don't save the last same info.
+ */
+ if ((oe - ols) < MIN_END_KEEP) {
+ ols = oe;
+ nls = ne;
+ }
+ /*
+ * Pragmatics II: if the terminal isn't smart enough, make the data
+ * dumber so the smart update doesn't try anything fancy
+ */
+
+ /*
+ * fx is the number of characters we need to insert/delete: in the
+ * beginning to bring the two same begins together
+ */
+ fx = (nsb - nfd) - (osb - ofd);
+ /*
+ * sx is the number of characters we need to insert/delete: in the
+ * end to bring the two same last parts together
+ */
+ sx = (nls - nse) - (ols - ose);
+
+ if (!EL_CAN_INSERT) {
+ if (fx > 0) {
+ osb = ols;
+ ose = ols;
+ nsb = nls;
+ nse = nls;
+ }
+ if (sx > 0) {
+ ols = oe;
+ nls = ne;
+ }
+ if ((ols - ofd) < (nls - nfd)) {
+ ols = oe;
+ nls = ne;
+ }
+ }
+ if (!EL_CAN_DELETE) {
+ if (fx < 0) {
+ osb = ols;
+ ose = ols;
+ nsb = nls;
+ nse = nls;
+ }
+ if (sx < 0) {
+ ols = oe;
+ nls = ne;
+ }
+ if ((ols - ofd) > (nls - nfd)) {
+ ols = oe;
+ nls = ne;
+ }
+ }
+ /*
+ * Pragmatics III: make sure the middle shifted pointers are correct if
+ * they don't point to anything (we may have moved ols or nls).
+ */
+ /* if the change isn't worth it, don't bother */
+ /* was: if (osb == ose) */
+ if ((ose - osb) < MIN_END_KEEP) {
+ osb = ols;
+ ose = ols;
+ nsb = nls;
+ nse = nls;
+ }
+ /*
+ * Now that we are done with pragmatics we recompute fx, sx
+ */
+ fx = (nsb - nfd) - (osb - ofd);
+ sx = (nls - nse) - (ols - ose);
+
+ ELRE_DEBUG(1, (__F, "fx %d, sx %d\n", fx, sx));
+ ELRE_DEBUG(1, (__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
+ ofd - old, osb - old, ose - old, ols - old, oe - old));
+ ELRE_DEBUG(1, (__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
+ nfd - new, nsb - new, nse - new, nls - new, ne - new));
+ ELRE_DEBUG(1, (__F,
+ "xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n"));
+ ELRE_DEBUG(1, (__F,
+ "xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n"));
+#ifdef DEBUG_REFRESH
+ re_printstr(el, "old- oe", old, oe);
+ re_printstr(el, "new- ne", new, ne);
+ re_printstr(el, "old-ofd", old, ofd);
+ re_printstr(el, "new-nfd", new, nfd);
+ re_printstr(el, "ofd-osb", ofd, osb);
+ re_printstr(el, "nfd-nsb", nfd, nsb);
+ re_printstr(el, "osb-ose", osb, ose);
+ re_printstr(el, "nsb-nse", nsb, nse);
+ re_printstr(el, "ose-ols", ose, ols);
+ re_printstr(el, "nse-nls", nse, nls);
+ re_printstr(el, "ols- oe", ols, oe);
+ re_printstr(el, "nls- ne", nls, ne);
+#endif /* DEBUG_REFRESH */
+
+ /*
+ * el_cursor.v to this line i MUST be in this routine so that if we
+ * don't have to change the line, we don't move to it. el_cursor.h to
+ * first diff char
+ */
+ term_move_to_line(el, i);
+
+ /*
+ * at this point we have something like this:
+ *
+ * /old /ofd /osb /ose /ols /oe
+ * v.....................v v..................v v........v
+ * eddie> Oh, my fredded gruntle-buggy is to me, as foo var lurgid as
+ * eddie> Oh, my fredded quiux buggy is to me, as gruntle-lurgid as
+ * ^.....................^ ^..................^ ^........^
+ * \new \nfd \nsb \nse \nls \ne
+ *
+ * fx is the difference in length between the chars between nfd and
+ * nsb, and the chars between ofd and osb, and is thus the number of
+ * characters to delete if < 0 (new is shorter than old, as above),
+ * or insert (new is longer than short).
+ *
+ * sx is the same for the second differences.
+ */
+
+ /*
+ * if we have a net insert on the first difference, AND inserting the
+ * net amount ((nsb-nfd) - (osb-ofd)) won't push the last useful
+ * character (which is ne if nls != ne, otherwise is nse) off the edge
+ * of the screen (el->el_term.t_size.h) else we do the deletes first
+ * so that we keep everything we need to.
+ */
+
+ /*
+ * if the last same is the same like the end, there is no last same
+ * part, otherwise we want to keep the last same part set p to the
+ * last useful old character
+ */
+ p = (ols != oe) ? oe : ose;
+
+ /*
+ * if (There is a diffence in the beginning) && (we need to insert
+ * characters) && (the number of characters to insert is less than
+ * the term width)
+ * We need to do an insert!
+ * else if (we need to delete characters)
+ * We need to delete characters!
+ * else
+ * No insert or delete
+ */
+ if ((nsb != nfd) && fx > 0 &&
+ ((p - old) + fx <= el->el_term.t_size.h)) {
+ ELRE_DEBUG(1,
+ (__F, "first diff insert at %d...\r\n", nfd - new));
+ /*
+ * Move to the first char to insert, where the first diff is.
+ */
+ term_move_to_char(el, nfd - new);
+ /*
+ * Check if we have stuff to keep at end
+ */
+ if (nsb != ne) {
+ ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n"));
+ /*
+ * insert fx chars of new starting at nfd
+ */
+ if (fx > 0) {
+ ELRE_DEBUG(!EL_CAN_INSERT, (__F,
+ "ERROR: cannot insert in early first diff\n"));
+ term_insertwrite(el, nfd, fx);
+ re_insert(el, old, ofd - old,
+ el->el_term.t_size.h, nfd, fx);
+ }
+ /*
+ * write (nsb-nfd) - fx chars of new starting at
+ * (nfd + fx)
+ */
+ term_overwrite(el, nfd + fx, (nsb - nfd) - fx);
+ re__strncopy(ofd + fx, nfd + fx,
+ (size_t) ((nsb - nfd) - fx));
+ } else {
+ ELRE_DEBUG(1, (__F, "without anything to save\r\n"));
+ term_overwrite(el, nfd, (nsb - nfd));
+ re__strncopy(ofd, nfd, (size_t) (nsb - nfd));
+ /*
+ * Done
+ */
+ return;
+ }
+ } else if (fx < 0) {
+ ELRE_DEBUG(1,
+ (__F, "first diff delete at %d...\r\n", ofd - old));
+ /*
+ * move to the first char to delete where the first diff is
+ */
+ term_move_to_char(el, ofd - old);
+ /*
+ * Check if we have stuff to save
+ */
+ if (osb != oe) {
+ ELRE_DEBUG(1, (__F, "with stuff to save at end\r\n"));
+ /*
+ * fx is less than zero *always* here but we check
+ * for code symmetry
+ */
+ if (fx < 0) {
+ ELRE_DEBUG(!EL_CAN_DELETE, (__F,
+ "ERROR: cannot delete in first diff\n"));
+ term_deletechars(el, -fx);
+ re_delete(el, old, ofd - old,
+ el->el_term.t_size.h, -fx);
+ }
+ /*
+ * write (nsb-nfd) chars of new starting at nfd
+ */
+ term_overwrite(el, nfd, (nsb - nfd));
+ re__strncopy(ofd, nfd, (size_t) (nsb - nfd));
+
+ } else {
+ ELRE_DEBUG(1, (__F,
+ "but with nothing left to save\r\n"));
+ /*
+ * write (nsb-nfd) chars of new starting at nfd
+ */
+ term_overwrite(el, nfd, (nsb - nfd));
+ re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
+ /*
+ * Done
+ */
+ return;
+ }
+ } else
+ fx = 0;
+
+ if (sx < 0 && (ose - old) + fx < el->el_term.t_size.h) {
+ ELRE_DEBUG(1, (__F,
+ "second diff delete at %d...\r\n", (ose - old) + fx));
+ /*
+ * Check if we have stuff to delete
+ */
+ /*
+ * fx is the number of characters inserted (+) or deleted (-)
+ */
+
+ term_move_to_char(el, (ose - old) + fx);
+ /*
+ * Check if we have stuff to save
+ */
+ if (ols != oe) {
+ ELRE_DEBUG(1, (__F, "with stuff to save at end\r\n"));
+ /*
+ * Again a duplicate test.
+ */
+ if (sx < 0) {
+ ELRE_DEBUG(!EL_CAN_DELETE, (__F,
+ "ERROR: cannot delete in second diff\n"));
+ term_deletechars(el, -sx);
+ }
+ /*
+ * write (nls-nse) chars of new starting at nse
+ */
+ term_overwrite(el, nse, (nls - nse));
+ } else {
+ ELRE_DEBUG(1, (__F,
+ "but with nothing left to save\r\n"));
+ term_overwrite(el, nse, (nls - nse));
+ re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
+ }
+ }
+ /*
+ * if we have a first insert AND WE HAVEN'T ALREADY DONE IT...
+ */
+ if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) {
+ ELRE_DEBUG(1, (__F, "late first diff insert at %d...\r\n",
+ nfd - new));
+
+ term_move_to_char(el, nfd - new);
+ /*
+ * Check if we have stuff to keep at the end
+ */
+ if (nsb != ne) {
+ ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n"));
+ /*
+ * We have to recalculate fx here because we set it
+ * to zero above as a flag saying that we hadn't done
+ * an early first insert.
+ */
+ fx = (nsb - nfd) - (osb - ofd);
+ if (fx > 0) {
+ /*
+ * insert fx chars of new starting at nfd
+ */
+ ELRE_DEBUG(!EL_CAN_INSERT, (__F,
+ "ERROR: cannot insert in late first diff\n"));
+ term_insertwrite(el, nfd, fx);
+ re_insert(el, old, ofd - old,
+ el->el_term.t_size.h, nfd, fx);
+ }
+ /*
+ * write (nsb-nfd) - fx chars of new starting at
+ * (nfd + fx)
+ */
+ term_overwrite(el, nfd + fx, (nsb - nfd) - fx);
+ re__strncopy(ofd + fx, nfd + fx,
+ (size_t) ((nsb - nfd) - fx));
+ } else {
+ ELRE_DEBUG(1, (__F, "without anything to save\r\n"));
+ term_overwrite(el, nfd, (nsb - nfd));
+ re__strncopy(ofd, nfd, (size_t) (nsb - nfd));
+ }
+ }
+ /*
+ * line is now NEW up to nse
+ */
+ if (sx >= 0) {
+ ELRE_DEBUG(1, (__F,
+ "second diff insert at %d...\r\n", nse - new));
+ term_move_to_char(el, nse - new);
+ if (ols != oe) {
+ ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n"));
+ if (sx > 0) {
+ /* insert sx chars of new starting at nse */
+ ELRE_DEBUG(!EL_CAN_INSERT, (__F,
+ "ERROR: cannot insert in second diff\n"));
+ term_insertwrite(el, nse, sx);
+ }
+ /*
+ * write (nls-nse) - sx chars of new starting at
+ * (nse + sx)
+ */
+ term_overwrite(el, nse + sx, (nls - nse) - sx);
+ } else {
+ ELRE_DEBUG(1, (__F, "without anything to save\r\n"));
+ term_overwrite(el, nse, (nls - nse));
+
+ /*
+ * No need to do a clear-to-end here because we were
+ * doing a second insert, so we will have over
+ * written all of the old string.
+ */
+ }
+ }
+ ELRE_DEBUG(1, (__F, "done.\r\n"));
+}
+
+
+/* re__copy_and_pad():
+ * Copy string and pad with spaces
+ */
+private void
+re__copy_and_pad(char *dst, const char *src, size_t width)
+{
+ size_t i;
+
+ for (i = 0; i < width; i++) {
+ if (*src == '\0')
+ break;
+ *dst++ = *src++;
+ }
+
+ for (; i < width; i++)
+ *dst++ = ' ';
+
+ *dst = '\0';
+}
+
+
+/* re_refresh_cursor():
+ * Move to the new cursor position
+ */
+protected void
+re_refresh_cursor(EditLine *el)
+{
+ char *cp, c;
+ int h, v, th;
+
+ if (el->el_line.cursor >= el->el_line.lastchar) {
+ if (el->el_map.current == el->el_map.alt
+ && el->el_line.lastchar != el->el_line.buffer)
+ el->el_line.cursor = el->el_line.lastchar - 1;
+ else
+ el->el_line.cursor = el->el_line.lastchar;
+ }
+
+ /* first we must find where the cursor is... */
+ h = el->el_prompt.p_pos.h;
+ v = el->el_prompt.p_pos.v;
+ th = el->el_term.t_size.h; /* optimize for speed */
+
+ /* do input buffer to el->el_line.cursor */
+ for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) {
+ c = *cp;
+ h++; /* all chars at least this long */
+
+ if (c == '\n') {/* handle newline in data part too */
+ h = 0;
+ v++;
+ } else {
+ if (c == '\t') { /* if a tab, to next tab stop */
+ while (h & 07) {
+ h++;
+ }
+ } else if (iscntrl((unsigned char) c)) {
+ /* if control char */
+ h++;
+ if (h > th) { /* if overflow, compensate */
+ h = 1;
+ v++;
+ }
+ } else if (!isprint((unsigned char) c)) {
+ h += 3;
+ if (h > th) { /* if overflow, compensate */
+ h = h - th;
+ v++;
+ }
+ }
+ }
+
+ if (h >= th) { /* check, extra long tabs picked up here also */
+ h = 0;
+ v++;
+ }
+ }
+
+ /* now go there */
+ term_move_to_line(el, v);
+ term_move_to_char(el, h);
+ term__flush();
+}
+
+
+/* re_fastputc():
+ * Add a character fast.
+ */
+private void
+re_fastputc(EditLine *el, int c)
+{
+
+ term__putc(c);
+ el->el_display[el->el_cursor.v][el->el_cursor.h++] = c;
+ if (el->el_cursor.h >= el->el_term.t_size.h) {
+ /* if we must overflow */
+ el->el_cursor.h = 0;
+
+ /*
+ * If we would overflow (input is longer than terminal size),
+ * emulate scroll by dropping first line and shuffling the rest.
+ * We do this via pointer shuffling - it's safe in this case
+ * and we avoid memcpy().
+ */
+ if (el->el_cursor.v + 1 >= el->el_term.t_size.v) {
+ int i, lins = el->el_term.t_size.v;
+ char *firstline = el->el_display[0];
+
+ for(i=1; i < lins; i++)
+ el->el_display[i-1] = el->el_display[i];
+
+ re__copy_and_pad(firstline, "", 0);
+ el->el_display[i-1] = firstline;
+ } else {
+ el->el_cursor.v++;
+ el->el_refresh.r_oldcv++;
+ }
+ if (EL_HAS_AUTO_MARGINS) {
+ if (EL_HAS_MAGIC_MARGINS) {
+ term__putc(' ');
+ term__putc('\b');
+ }
+ } else {
+ term__putc('\r');
+ term__putc('\n');
+ }
+ }
+}
+
+
+/* re_fastaddc():
+ * we added just one char, handle it fast.
+ * Assumes that screen cursor == real cursor
+ */
+protected void
+re_fastaddc(EditLine *el)
+{
+ char c;
+ int rhdiff;
+
+ c = el->el_line.cursor[-1];
+
+ if (c == '\t' || el->el_line.cursor != el->el_line.lastchar) {
+ re_refresh(el); /* too hard to handle */
+ return;
+ }
+ rhdiff = el->el_term.t_size.h - el->el_cursor.h -
+ el->el_rprompt.p_pos.h;
+ if (el->el_rprompt.p_pos.h && rhdiff < 3) {
+ re_refresh(el); /* clear out rprompt if less than 1 char gap */
+ return;
+ } /* else (only do at end of line, no TAB) */
+ if (iscntrl((unsigned char) c)) { /* if control char, do caret */
+ char mc = (c == '\177') ? '?' : (c | 0100);
+ re_fastputc(el, '^');
+ re_fastputc(el, mc);
+ } else if (isprint((unsigned char) c)) { /* normal char */
+ re_fastputc(el, c);
+ } else {
+ re_fastputc(el, '\\');
+ re_fastputc(el, (int)(((((unsigned int)c) >> 6) & 3) + '0'));
+ re_fastputc(el, (int)(((((unsigned int)c) >> 3) & 7) + '0'));
+ re_fastputc(el, (c & 7) + '0');
+ }
+ term__flush();
+}
+
+
+/* re_clear_display():
+ * clear the screen buffers so that new new prompt starts fresh.
+ */
+protected void
+re_clear_display(EditLine *el)
+{
+ int i;
+
+ el->el_cursor.v = 0;
+ el->el_cursor.h = 0;
+ for (i = 0; i < el->el_term.t_size.v; i++)
+ el->el_display[i][0] = '\0';
+ el->el_refresh.r_oldcv = 0;
+}
+
+
+/* re_clear_lines():
+ * Make sure all lines are *really* blank
+ */
+protected void
+re_clear_lines(EditLine *el)
+{
+
+ if (EL_CAN_CEOL) {
+ int i;
+ term_move_to_char(el, 0);
+ for (i = 0; i <= el->el_refresh.r_oldcv; i++) {
+ /* for each line on the screen */
+ term_move_to_line(el, i);
+ term_clear_EOL(el, el->el_term.t_size.h);
+ }
+ term_move_to_line(el, 0);
+ } else {
+ term_move_to_line(el, el->el_refresh.r_oldcv);
+ /* go to last line */
+ term__putc('\r'); /* go to BOL */
+ term__putc('\n'); /* go to new line */
+ }
+}
diff --git a/frontend/libedit/refresh.h b/frontend/libedit/refresh.h
new file mode 100644
index 0000000..dd2bd02
--- /dev/null
+++ b/frontend/libedit/refresh.h
@@ -0,0 +1,59 @@
+/* $NetBSD: refresh.h,v 1.5 2003/08/07 16:44:33 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)refresh.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.refresh.h: Screen refresh functions
+ */
+#ifndef _h_el_refresh
+#define _h_el_refresh
+
+#include "histedit.h"
+
+typedef struct {
+ coord_t r_cursor; /* Refresh cursor position */
+ int r_oldcv; /* Vertical locations */
+ int r_newcv;
+} el_refresh_t;
+
+protected void re_putc(EditLine *, int, int);
+protected void re_clear_lines(EditLine *);
+protected void re_clear_display(EditLine *);
+protected void re_refresh(EditLine *);
+protected void re_refresh_cursor(EditLine *);
+protected void re_fastaddc(EditLine *);
+protected void re_goto_bottom(EditLine *);
+
+#endif /* _h_el_refresh */
diff --git a/frontend/libedit/search.c b/frontend/libedit/search.c
new file mode 100644
index 0000000..803b0eb
--- /dev/null
+++ b/frontend/libedit/search.c
@@ -0,0 +1,627 @@
+/* $NetBSD: search.c,v 1.20 2004/11/04 01:16:03 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * search.c: History and character search functions
+ */
+#include <stdlib.h>
+#include <sys/types.h>
+#if defined(REGEX)
+#include <regex.h>
+#elif defined(REGEXP)
+#include <regexp.h>
+#endif
+#include "el.h"
+
+/*
+ * Adjust cursor in vi mode to include the character under it
+ */
+#define EL_CURSOR(el) \
+ ((el)->el_line.cursor + (((el)->el_map.type == MAP_VI) && \
+ ((el)->el_map.current == (el)->el_map.alt)))
+
+/* search_init():
+ * Initialize the search stuff
+ */
+protected int
+search_init(EditLine *el)
+{
+
+ el->el_search.patbuf = (char *) el_malloc(EL_BUFSIZ);
+ if (el->el_search.patbuf == NULL)
+ return (-1);
+ el->el_search.patlen = 0;
+ el->el_search.patdir = -1;
+ el->el_search.chacha = '\0';
+ el->el_search.chadir = CHAR_FWD;
+ el->el_search.chatflg = 0;
+ return (0);
+}
+
+
+/* search_end():
+ * Initialize the search stuff
+ */
+protected void
+search_end(EditLine *el)
+{
+
+ el_free((ptr_t) el->el_search.patbuf);
+ el->el_search.patbuf = NULL;
+}
+
+
+#ifdef REGEXP
+/* regerror():
+ * Handle regular expression errors
+ */
+public void
+/*ARGSUSED*/
+regerror(const char *msg)
+{
+}
+#endif
+
+
+/* el_match():
+ * Return if string matches pattern
+ */
+protected int
+el_match(const char *str, const char *pat)
+{
+#if defined (REGEX)
+ regex_t re;
+ int rv;
+#elif defined (REGEXP)
+ regexp *rp;
+ int rv;
+#else
+ extern char *re_comp(const char *);
+ extern int re_exec(const char *);
+#endif
+
+ if (strstr(str, pat) != NULL)
+ return (1);
+
+#if defined(REGEX)
+ if (regcomp(&re, pat, 0) == 0) {
+ rv = regexec(&re, str, 0, NULL, 0) == 0;
+ regfree(&re);
+ } else {
+ rv = 0;
+ }
+ return (rv);
+#elif defined(REGEXP)
+ if ((re = regcomp(pat)) != NULL) {
+ rv = regexec(re, str);
+ free((ptr_t) re);
+ } else {
+ rv = 0;
+ }
+ return (rv);
+#else
+ if (re_comp(pat) != NULL)
+ return (0);
+ else
+ return (re_exec(str) == 1);
+#endif
+}
+
+
+/* c_hmatch():
+ * return True if the pattern matches the prefix
+ */
+protected int
+c_hmatch(EditLine *el, const char *str)
+{
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "match `%s' with `%s'\n",
+ el->el_search.patbuf, str);
+#endif /* SDEBUG */
+
+ return (el_match(str, el->el_search.patbuf));
+}
+
+
+/* c_setpat():
+ * Set the history seatch pattern
+ */
+protected void
+c_setpat(EditLine *el)
+{
+ if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY &&
+ el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) {
+ el->el_search.patlen = EL_CURSOR(el) - el->el_line.buffer;
+ if (el->el_search.patlen >= EL_BUFSIZ)
+ el->el_search.patlen = EL_BUFSIZ - 1;
+ if (el->el_search.patlen != 0) {
+ (void) strncpy(el->el_search.patbuf, el->el_line.buffer,
+ el->el_search.patlen);
+ el->el_search.patbuf[el->el_search.patlen] = '\0';
+ } else
+ el->el_search.patlen = strlen(el->el_search.patbuf);
+ }
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "\neventno = %d\n",
+ el->el_history.eventno);
+ (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen);
+ (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n",
+ el->el_search.patbuf);
+ (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n",
+ EL_CURSOR(el) - el->el_line.buffer,
+ el->el_line.lastchar - el->el_line.buffer);
+#endif
+}
+
+
+/* ce_inc_search():
+ * Emacs incremental search
+ */
+protected el_action_t
+ce_inc_search(EditLine *el, int dir)
+{
+ static const char STRfwd[] = {'f', 'w', 'd', '\0'},
+ STRbck[] = {'b', 'c', 'k', '\0'};
+ static char pchar = ':';/* ':' = normal, '?' = failed */
+ static char endcmd[2] = {'\0', '\0'};
+ char ch, *ocursor = el->el_line.cursor, oldpchar = pchar;
+ const char *cp;
+
+ el_action_t ret = CC_NORM;
+
+ int ohisteventno = el->el_history.eventno;
+ int oldpatlen = el->el_search.patlen;
+ int newdir = dir;
+ int done, redo;
+
+ if (el->el_line.lastchar + sizeof(STRfwd) / sizeof(char) + 2 +
+ el->el_search.patlen >= el->el_line.limit)
+ return (CC_ERROR);
+
+ for (;;) {
+
+ if (el->el_search.patlen == 0) { /* first round */
+ pchar = ':';
+#ifdef ANCHOR
+#define LEN 2
+ el->el_search.patbuf[el->el_search.patlen++] = '.';
+ el->el_search.patbuf[el->el_search.patlen++] = '*';
+#else
+#define LEN 0
+#endif
+ }
+ done = redo = 0;
+ *el->el_line.lastchar++ = '\n';
+ for (cp = (newdir == ED_SEARCH_PREV_HISTORY) ? STRbck : STRfwd;
+ *cp; *el->el_line.lastchar++ = *cp++)
+ continue;
+ *el->el_line.lastchar++ = pchar;
+ for (cp = &el->el_search.patbuf[LEN];
+ cp < &el->el_search.patbuf[el->el_search.patlen];
+ *el->el_line.lastchar++ = *cp++)
+ continue;
+ *el->el_line.lastchar = '\0';
+ re_refresh(el);
+
+ if (el_getc(el, &ch) != 1)
+ return (ed_end_of_file(el, 0));
+
+ switch (el->el_map.current[(unsigned char) ch]) {
+ case ED_INSERT:
+ case ED_DIGIT:
+ if (el->el_search.patlen >= EL_BUFSIZ - LEN)
+ term_beep(el);
+ else {
+ el->el_search.patbuf[el->el_search.patlen++] =
+ ch;
+ *el->el_line.lastchar++ = ch;
+ *el->el_line.lastchar = '\0';
+ re_refresh(el);
+ }
+ break;
+
+ case EM_INC_SEARCH_NEXT:
+ newdir = ED_SEARCH_NEXT_HISTORY;
+ redo++;
+ break;
+
+ case EM_INC_SEARCH_PREV:
+ newdir = ED_SEARCH_PREV_HISTORY;
+ redo++;
+ break;
+
+ case ED_DELETE_PREV_CHAR:
+ if (el->el_search.patlen > LEN)
+ done++;
+ else
+ term_beep(el);
+ break;
+
+ default:
+ switch (ch) {
+ case 0007: /* ^G: Abort */
+ ret = CC_ERROR;
+ done++;
+ break;
+
+ case 0027: /* ^W: Append word */
+ /* No can do if globbing characters in pattern */
+ for (cp = &el->el_search.patbuf[LEN];; cp++)
+ if (cp >= &el->el_search.patbuf[
+ el->el_search.patlen]) {
+ el->el_line.cursor +=
+ el->el_search.patlen - LEN - 1;
+ cp = c__next_word(el->el_line.cursor,
+ el->el_line.lastchar, 1,
+ ce__isword);
+ while (el->el_line.cursor < cp &&
+ *el->el_line.cursor != '\n') {
+ if (el->el_search.patlen >=
+ EL_BUFSIZ - LEN) {
+ term_beep(el);
+ break;
+ }
+ el->el_search.patbuf[el->el_search.patlen++] =
+ *el->el_line.cursor;
+ *el->el_line.lastchar++ =
+ *el->el_line.cursor++;
+ }
+ el->el_line.cursor = ocursor;
+ *el->el_line.lastchar = '\0';
+ re_refresh(el);
+ break;
+ } else if (isglob(*cp)) {
+ term_beep(el);
+ break;
+ }
+ break;
+
+ default: /* Terminate and execute cmd */
+ endcmd[0] = ch;
+ el_push(el, endcmd);
+ /* FALLTHROUGH */
+
+ case 0033: /* ESC: Terminate */
+ ret = CC_REFRESH;
+ done++;
+ break;
+ }
+ break;
+ }
+
+ while (el->el_line.lastchar > el->el_line.buffer &&
+ *el->el_line.lastchar != '\n')
+ *el->el_line.lastchar-- = '\0';
+ *el->el_line.lastchar = '\0';
+
+ if (!done) {
+
+ /* Can't search if unmatched '[' */
+ for (cp = &el->el_search.patbuf[el->el_search.patlen-1],
+ ch = ']';
+ cp >= &el->el_search.patbuf[LEN];
+ cp--)
+ if (*cp == '[' || *cp == ']') {
+ ch = *cp;
+ break;
+ }
+ if (el->el_search.patlen > LEN && ch != '[') {
+ if (redo && newdir == dir) {
+ if (pchar == '?') { /* wrap around */
+ el->el_history.eventno =
+ newdir == ED_SEARCH_PREV_HISTORY ? 0 : 0x7fffffff;
+ if (hist_get(el) == CC_ERROR)
+ /* el->el_history.event
+ * no was fixed by
+ * first call */
+ (void) hist_get(el);
+ el->el_line.cursor = newdir ==
+ ED_SEARCH_PREV_HISTORY ?
+ el->el_line.lastchar :
+ el->el_line.buffer;
+ } else
+ el->el_line.cursor +=
+ newdir ==
+ ED_SEARCH_PREV_HISTORY ?
+ -1 : 1;
+ }
+#ifdef ANCHOR
+ el->el_search.patbuf[el->el_search.patlen++] =
+ '.';
+ el->el_search.patbuf[el->el_search.patlen++] =
+ '*';
+#endif
+ el->el_search.patbuf[el->el_search.patlen] =
+ '\0';
+ if (el->el_line.cursor < el->el_line.buffer ||
+ el->el_line.cursor > el->el_line.lastchar ||
+ (ret = ce_search_line(el, newdir))
+ == CC_ERROR) {
+ /* avoid c_setpat */
+ el->el_state.lastcmd =
+ (el_action_t) newdir;
+ ret = newdir == ED_SEARCH_PREV_HISTORY ?
+ ed_search_prev_history(el, 0) :
+ ed_search_next_history(el, 0);
+ if (ret != CC_ERROR) {
+ el->el_line.cursor = newdir ==
+ ED_SEARCH_PREV_HISTORY ?
+ el->el_line.lastchar :
+ el->el_line.buffer;
+ (void) ce_search_line(el,
+ newdir);
+ }
+ }
+ el->el_search.patlen -= LEN;
+ el->el_search.patbuf[el->el_search.patlen] =
+ '\0';
+ if (ret == CC_ERROR) {
+ term_beep(el);
+ if (el->el_history.eventno !=
+ ohisteventno) {
+ el->el_history.eventno =
+ ohisteventno;
+ if (hist_get(el) == CC_ERROR)
+ return (CC_ERROR);
+ }
+ el->el_line.cursor = ocursor;
+ pchar = '?';
+ } else {
+ pchar = ':';
+ }
+ }
+ ret = ce_inc_search(el, newdir);
+
+ if (ret == CC_ERROR && pchar == '?' && oldpchar == ':')
+ /*
+ * break abort of failed search at last
+ * non-failed
+ */
+ ret = CC_NORM;
+
+ }
+ if (ret == CC_NORM || (ret == CC_ERROR && oldpatlen == 0)) {
+ /* restore on normal return or error exit */
+ pchar = oldpchar;
+ el->el_search.patlen = oldpatlen;
+ if (el->el_history.eventno != ohisteventno) {
+ el->el_history.eventno = ohisteventno;
+ if (hist_get(el) == CC_ERROR)
+ return (CC_ERROR);
+ }
+ el->el_line.cursor = ocursor;
+ if (ret == CC_ERROR)
+ re_refresh(el);
+ }
+ if (done || ret != CC_NORM)
+ return (ret);
+ }
+}
+
+
+/* cv_search():
+ * Vi search.
+ */
+protected el_action_t
+cv_search(EditLine *el, int dir)
+{
+ char ch;
+ char tmpbuf[EL_BUFSIZ];
+ int tmplen;
+
+#ifdef ANCHOR
+ tmpbuf[0] = '.';
+ tmpbuf[1] = '*';
+#endif
+ tmplen = LEN;
+
+ el->el_search.patdir = dir;
+
+ tmplen = c_gets(el, &tmpbuf[LEN],
+ dir == ED_SEARCH_PREV_HISTORY ? "\n/" : "\n?" );
+ if (tmplen == -1)
+ return CC_REFRESH;
+
+ tmplen += LEN;
+ ch = tmpbuf[tmplen];
+ tmpbuf[tmplen] = '\0';
+
+ if (tmplen == LEN) {
+ /*
+ * Use the old pattern, but wild-card it.
+ */
+ if (el->el_search.patlen == 0) {
+ re_refresh(el);
+ return (CC_ERROR);
+ }
+#ifdef ANCHOR
+ if (el->el_search.patbuf[0] != '.' &&
+ el->el_search.patbuf[0] != '*') {
+ (void) strncpy(tmpbuf, el->el_search.patbuf,
+ sizeof(tmpbuf) - 1);
+ el->el_search.patbuf[0] = '.';
+ el->el_search.patbuf[1] = '*';
+ (void) strncpy(&el->el_search.patbuf[2], tmpbuf,
+ EL_BUFSIZ - 3);
+ el->el_search.patlen++;
+ el->el_search.patbuf[el->el_search.patlen++] = '.';
+ el->el_search.patbuf[el->el_search.patlen++] = '*';
+ el->el_search.patbuf[el->el_search.patlen] = '\0';
+ }
+#endif
+ } else {
+#ifdef ANCHOR
+ tmpbuf[tmplen++] = '.';
+ tmpbuf[tmplen++] = '*';
+#endif
+ tmpbuf[tmplen] = '\0';
+ (void) strncpy(el->el_search.patbuf, tmpbuf, EL_BUFSIZ - 1);
+ el->el_search.patlen = tmplen;
+ }
+ el->el_state.lastcmd = (el_action_t) dir; /* avoid c_setpat */
+ el->el_line.cursor = el->el_line.lastchar = el->el_line.buffer;
+ if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) :
+ ed_search_next_history(el, 0)) == CC_ERROR) {
+ re_refresh(el);
+ return (CC_ERROR);
+ }
+ if (ch == 0033) {
+ re_refresh(el);
+ return ed_newline(el, 0);
+ }
+ return (CC_REFRESH);
+}
+
+
+/* ce_search_line():
+ * Look for a pattern inside a line
+ */
+protected el_action_t
+ce_search_line(EditLine *el, int dir)
+{
+ char *cp = el->el_line.cursor;
+ char *pattern = el->el_search.patbuf;
+ char oc, *ocp;
+#ifdef ANCHOR
+ ocp = &pattern[1];
+ oc = *ocp;
+ *ocp = '^';
+#else
+ ocp = pattern;
+ oc = *ocp;
+#endif
+
+ if (dir == ED_SEARCH_PREV_HISTORY) {
+ for (; cp >= el->el_line.buffer; cp--) {
+ if (el_match(cp, ocp)) {
+ *ocp = oc;
+ el->el_line.cursor = cp;
+ return (CC_NORM);
+ }
+ }
+ *ocp = oc;
+ return (CC_ERROR);
+ } else {
+ for (; *cp != '\0' && cp < el->el_line.limit; cp++) {
+ if (el_match(cp, ocp)) {
+ *ocp = oc;
+ el->el_line.cursor = cp;
+ return (CC_NORM);
+ }
+ }
+ *ocp = oc;
+ return (CC_ERROR);
+ }
+}
+
+
+/* cv_repeat_srch():
+ * Vi repeat search
+ */
+protected el_action_t
+cv_repeat_srch(EditLine *el, int c)
+{
+
+#ifdef SDEBUG
+ (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n",
+ c, el->el_search.patlen, el->el_search.patbuf);
+#endif
+
+ el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */
+ el->el_line.lastchar = el->el_line.buffer;
+
+ switch (c) {
+ case ED_SEARCH_NEXT_HISTORY:
+ return (ed_search_next_history(el, 0));
+ case ED_SEARCH_PREV_HISTORY:
+ return (ed_search_prev_history(el, 0));
+ default:
+ return (CC_ERROR);
+ }
+}
+
+
+/* cv_csearch():
+ * Vi character search
+ */
+protected el_action_t
+cv_csearch(EditLine *el, int direction, int ch, int count, int tflag)
+{
+ char *cp;
+
+ if (ch == 0)
+ return CC_ERROR;
+
+ if (ch == -1) {
+ char c;
+ if (el_getc(el, &c) != 1)
+ return ed_end_of_file(el, 0);
+ ch = c;
+ }
+
+ /* Save for ';' and ',' commands */
+ el->el_search.chacha = ch;
+ el->el_search.chadir = direction;
+ el->el_search.chatflg = tflag;
+
+ cp = el->el_line.cursor;
+ while (count--) {
+ if (*cp == ch)
+ cp += direction;
+ for (;;cp += direction) {
+ if (cp >= el->el_line.lastchar)
+ return CC_ERROR;
+ if (cp < el->el_line.buffer)
+ return CC_ERROR;
+ if (*cp == ch)
+ break;
+ }
+ }
+
+ if (tflag)
+ cp -= direction;
+
+ el->el_line.cursor = cp;
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ if (direction > 0)
+ el->el_line.cursor++;
+ cv_delfini(el);
+ return CC_REFRESH;
+ }
+ return CC_CURSOR;
+}
diff --git a/frontend/libedit/search.h b/frontend/libedit/search.h
new file mode 100644
index 0000000..2aa8f98
--- /dev/null
+++ b/frontend/libedit/search.h
@@ -0,0 +1,66 @@
+/* $NetBSD: search.h,v 1.8 2003/10/18 23:27:36 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)search.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.search.h: Line and history searching utilities
+ */
+#ifndef _h_el_search
+#define _h_el_search
+
+#include "histedit.h"
+
+typedef struct el_search_t {
+ char *patbuf; /* The pattern buffer */
+ size_t patlen; /* Length of the pattern buffer */
+ int patdir; /* Direction of the last search */
+ int chadir; /* Character search direction */
+ char chacha; /* Character we are looking for */
+ char chatflg; /* 0 if f, 1 if t */
+} el_search_t;
+
+
+protected int el_match(const char *, const char *);
+protected int search_init(EditLine *);
+protected void search_end(EditLine *);
+protected int c_hmatch(EditLine *, const char *);
+protected void c_setpat(EditLine *);
+protected el_action_t ce_inc_search(EditLine *, int);
+protected el_action_t cv_search(EditLine *, int);
+protected el_action_t ce_search_line(EditLine *, int);
+protected el_action_t cv_repeat_srch(EditLine *, int);
+protected el_action_t cv_csearch(EditLine *, int, int, int, int);
+
+#endif /* _h_el_search */
diff --git a/frontend/libedit/sig.c b/frontend/libedit/sig.c
new file mode 100644
index 0000000..2bdad98
--- /dev/null
+++ b/frontend/libedit/sig.c
@@ -0,0 +1,188 @@
+/* $NetBSD: sig.c,v 1.11 2003/08/07 16:44:33 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * sig.c: Signal handling stuff.
+ * our policy is to trap all signals, set a good state
+ * and pass the ball to our caller.
+ */
+#include "el.h"
+#include <stdlib.h>
+
+private EditLine *sel = NULL;
+
+private const int sighdl[] = {
+#define _DO(a) (a),
+ ALLSIGS
+#undef _DO
+ - 1
+};
+
+private void sig_handler(int);
+
+/* sig_handler():
+ * This is the handler called for all signals
+ * XXX: we cannot pass any data so we just store the old editline
+ * state in a private variable
+ */
+private void
+sig_handler(int signo)
+{
+ int i;
+ sigset_t nset, oset;
+
+ (void) sigemptyset(&nset);
+ (void) sigaddset(&nset, signo);
+ (void) sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ switch (signo) {
+ case SIGCONT:
+ tty_rawmode(sel);
+ if (ed_redisplay(sel, 0) == CC_REFRESH)
+ re_refresh(sel);
+ term__flush();
+ break;
+
+ case SIGWINCH:
+ el_resize(sel);
+ break;
+
+ default:
+ tty_cookedmode(sel);
+ break;
+ }
+
+ for (i = 0; sighdl[i] != -1; i++)
+ if (signo == sighdl[i])
+ break;
+
+ (void) signal(signo, sel->el_signal[i]);
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+ (void) kill(0, signo);
+}
+
+
+/* sig_init():
+ * Initialize all signal stuff
+ */
+protected int
+sig_init(EditLine *el)
+{
+ int i;
+ sigset_t nset, oset;
+
+ (void) sigemptyset(&nset);
+#define _DO(a) (void) sigaddset(&nset, a);
+ ALLSIGS
+#undef _DO
+ (void) sigprocmask(SIG_BLOCK, &nset, &oset);
+
+#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(el_signalhandler_t))
+
+ el->el_signal = (el_signalhandler_t *) el_malloc(SIGSIZE);
+ if (el->el_signal == NULL)
+ return (-1);
+ for (i = 0; sighdl[i] != -1; i++)
+ el->el_signal[i] = SIG_ERR;
+
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+
+ return (0);
+}
+
+
+/* sig_end():
+ * Clear all signal stuff
+ */
+protected void
+sig_end(EditLine *el)
+{
+
+ el_free((ptr_t) el->el_signal);
+ el->el_signal = NULL;
+}
+
+
+/* sig_set():
+ * set all the signal handlers
+ */
+protected void
+sig_set(EditLine *el)
+{
+ int i;
+ sigset_t nset, oset;
+
+ (void) sigemptyset(&nset);
+#define _DO(a) (void) sigaddset(&nset, a);
+ ALLSIGS
+#undef _DO
+ (void) sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ for (i = 0; sighdl[i] != -1; i++) {
+ el_signalhandler_t s;
+ /* This could happen if we get interrupted */
+ if ((s = signal(sighdl[i], sig_handler)) != sig_handler)
+ el->el_signal[i] = s;
+ }
+ sel = el;
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+}
+
+
+/* sig_clr():
+ * clear all the signal handlers
+ */
+protected void
+sig_clr(EditLine *el)
+{
+ int i;
+ sigset_t nset, oset;
+
+ (void) sigemptyset(&nset);
+#define _DO(a) (void) sigaddset(&nset, a);
+ ALLSIGS
+#undef _DO
+ (void) sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ for (i = 0; sighdl[i] != -1; i++)
+ if (el->el_signal[i] != SIG_ERR)
+ (void) signal(sighdl[i], el->el_signal[i]);
+
+ sel = NULL; /* we are going to die if the handler is
+ * called */
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+}
diff --git a/frontend/libedit/sig.h b/frontend/libedit/sig.h
new file mode 100644
index 0000000..0bf1fc3
--- /dev/null
+++ b/frontend/libedit/sig.h
@@ -0,0 +1,69 @@
+/* $NetBSD: sig.h,v 1.5 2003/08/07 16:44:33 agc Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)sig.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.sig.h: Signal handling functions
+ */
+#ifndef _h_el_sig
+#define _h_el_sig
+
+#include <signal.h>
+
+#include "histedit.h"
+
+/*
+ * Define here all the signals we are going to handle
+ * The _DO macro is used to iterate in the source code
+ */
+#define ALLSIGS \
+ _DO(SIGINT) \
+ _DO(SIGTSTP) \
+ _DO(SIGSTOP) \
+ _DO(SIGQUIT) \
+ _DO(SIGHUP) \
+ _DO(SIGTERM) \
+ _DO(SIGCONT) \
+ _DO(SIGWINCH)
+
+typedef void (*el_signalhandler_t)(int);
+typedef el_signalhandler_t *el_signal_t;
+
+protected void sig_end(EditLine*);
+protected int sig_init(EditLine*);
+protected void sig_set(EditLine*);
+protected void sig_clr(EditLine*);
+
+#endif /* _h_el_sig */
diff --git a/frontend/libedit/strlcat.c b/frontend/libedit/strlcat.c
new file mode 100644
index 0000000..bf1c89f
--- /dev/null
+++ b/frontend/libedit/strlcat.c
@@ -0,0 +1,74 @@
+/* $NetBSD: strlcat.c,v 1.2 2006/03/30 20:37:51 christos Exp $ */
+/* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE
+ * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <config.h>
+#include "sys.h"
+
+#include <sys/types.h>
+#include <assert.h>
+#include <string.h>
+
+#ifdef _LIBC
+# ifdef __weak_alias
+__weak_alias(strlcat, _strlcat)
+# endif
+#endif
+
+#if !HAVE_STRLCAT
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left). At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
+ */
+size_t
+strlcat(dst, src, siz)
+ char *dst;
+ const char *src;
+ size_t siz;
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+ size_t dlen;
+
+ _DIAGASSERT(dst != NULL);
+ _DIAGASSERT(src != NULL);
+
+ /* Find the end of dst and adjust bytes left but don't go past end */
+ while (n-- != 0 && *d != '\0')
+ d++;
+ dlen = d - dst;
+ n = siz - dlen;
+
+ if (n == 0)
+ return(dlen + strlen(s));
+ while (*s != '\0') {
+ if (n != 1) {
+ *d++ = *s;
+ n--;
+ }
+ s++;
+ }
+ *d = '\0';
+
+ return(dlen + (s - src)); /* count does not include NUL */
+}
+#endif
diff --git a/frontend/libedit/strlcpy.c b/frontend/libedit/strlcpy.c
new file mode 100644
index 0000000..9587d4c
--- /dev/null
+++ b/frontend/libedit/strlcpy.c
@@ -0,0 +1,70 @@
+/* $NetBSD: strlcpy.c,v 1.2 2006/03/30 20:37:51 christos Exp $ */
+/* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE
+ * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <config.h>
+#include "sys.h"
+
+#include <sys/types.h>
+#include <assert.h>
+#include <string.h>
+
+#ifdef _LIBC
+# ifdef __weak_alias
+__weak_alias(strlcpy, _strlcpy)
+# endif
+#endif
+
+#if !HAVE_STRLCPY
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(dst, src, siz)
+ char *dst;
+ const char *src;
+ size_t siz;
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ _DIAGASSERT(dst != NULL);
+ _DIAGASSERT(src != NULL);
+
+ /* Copy as many bytes as will fit */
+ if (n != 0 && --n != 0) {
+ do {
+ if ((*d++ = *s++) == 0)
+ break;
+ } while (--n != 0);
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
+#endif
diff --git a/frontend/libedit/sys.h b/frontend/libedit/sys.h
new file mode 100644
index 0000000..fb710a5
--- /dev/null
+++ b/frontend/libedit/sys.h
@@ -0,0 +1,154 @@
+/* $NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)sys.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * sys.h: Put all the stupid compiler and system dependencies here...
+ */
+#ifndef _h_sys
+#define _h_sys
+
+#include <config.h>
+
+#ifdef HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
+# define __attribute__(A)
+#endif
+
+#ifndef __P
+# define __P(x) x
+#endif
+
+#ifndef _DIAGASSERT
+# define _DIAGASSERT(x)
+#endif
+
+#ifndef __BEGIN_DECLS
+# ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+# else
+# define __BEGIN_DECLS
+# define __END_DECLS
+# endif
+#endif
+
+#ifndef public
+# define public /* Externally visible functions/variables */
+#endif
+
+#ifndef private
+# define private static /* Always hidden internals */
+#endif
+
+#ifndef protected
+# define protected /* Redefined from elsewhere to "static" */
+ /* When we want to hide everything */
+#endif
+
+#ifndef HAVE_U_INT32_T
+typedef unsigned int u_int32_t;
+#endif
+
+#ifndef _PTR_T
+# define _PTR_T
+typedef void *ptr_t;
+#endif
+
+#ifndef _IOCTL_T
+# define _IOCTL_T
+typedef void *ioctl_t;
+#endif
+
+#include <stdio.h>
+
+#ifndef HAVE_STRLCAT
+#define strlcat libedit_strlcat
+size_t strlcat(char *dst, const char *src, size_t size);
+#endif
+
+#ifndef HAVE_STRLCPY
+#define strlcpy libedit_strlcpy
+size_t strlcpy(char *dst, const char *src, size_t size);
+#endif
+
+#ifndef HAVE_FGETLN
+#define fgetln libedit_fgetln
+char *fgetln(FILE *fp, size_t *len);
+#endif
+
+#define REGEX /* Use POSIX.2 regular expression functions */
+#undef REGEXP /* Use UNIX V8 regular expression functions */
+
+#ifdef notdef
+# undef REGEX
+# undef REGEXP
+# include <malloc.h>
+# ifdef __GNUC__
+/*
+ * Broken hdrs.
+ */
+extern int tgetent(const char *bp, char *name);
+extern int tgetflag(const char *id);
+extern int tgetnum(const char *id);
+extern char *tgetstr(const char *id, char **area);
+extern char *tgoto(const char *cap, int col, int row);
+extern int tputs(const char *str, int affcnt, int (*putc)(int));
+extern char *getenv(const char *);
+extern int fprintf(FILE *, const char *, ...);
+extern int sigsetmask(int);
+extern int sigblock(int);
+extern int fputc(int, FILE *);
+extern int fgetc(FILE *);
+extern int fflush(FILE *);
+extern int tolower(int);
+extern int toupper(int);
+extern int errno, sys_nerr;
+extern char *sys_errlist[];
+extern void perror(const char *);
+# include <string.h>
+# define strerror(e) sys_errlist[e]
+# endif
+# ifdef SABER
+extern ptr_t memcpy(ptr_t, const ptr_t, size_t);
+extern ptr_t memset(ptr_t, int, size_t);
+# endif
+extern char *fgetline(FILE *, int *);
+#endif
+
+#endif /* _h_sys */
diff --git a/frontend/libedit/term.c b/frontend/libedit/term.c
new file mode 100644
index 0000000..19dfd2e
--- /dev/null
+++ b/frontend/libedit/term.c
@@ -0,0 +1,1623 @@
+/* $NetBSD: term.c,v 1.45 2006/03/18 19:23:14 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * term.c: Editor/termcap-curses interface
+ * We have to declare a static variable here, since the
+ * termcap putchar routine does not take an argument!
+ */
+#include <stdio.h>
+#include <signal.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifdef HAVE_CURSES_H
+# include <curses.h>
+#elif HAVE_NCURSES_H
+# include <ncurses.h>
+#endif
+
+#ifdef HAVE_TERMCAP_H
+# include <termcap.h>
+#elif HAVE_TERMCAP_TERMCAP_H
+# include <termcap/termcap.h>
+#else
+# include <ncurses/termcap.h>
+#endif
+
+/* Solaris's term.h does horrid things. */
+#if (defined(HAVE_TERM_H) && !defined(_SUNOS))
+# include <term.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include "el.h"
+
+/*
+ * IMPORTANT NOTE: these routines are allowed to look at the current screen
+ * and the current possition assuming that it is correct. If this is not
+ * true, then the update will be WRONG! This is (should be) a valid
+ * assumption...
+ */
+
+#define TC_BUFSIZE 2048
+
+#define GoodStr(a) (el->el_term.t_str[a] != NULL && \
+ el->el_term.t_str[a][0] != '\0')
+#define Str(a) el->el_term.t_str[a]
+#define Val(a) el->el_term.t_val[a]
+
+#ifdef notdef
+private const struct {
+ const char *b_name;
+ int b_rate;
+} baud_rate[] = {
+#ifdef B0
+ { "0", B0 },
+#endif
+#ifdef B50
+ { "50", B50 },
+#endif
+#ifdef B75
+ { "75", B75 },
+#endif
+#ifdef B110
+ { "110", B110 },
+#endif
+#ifdef B134
+ { "134", B134 },
+#endif
+#ifdef B150
+ { "150", B150 },
+#endif
+#ifdef B200
+ { "200", B200 },
+#endif
+#ifdef B300
+ { "300", B300 },
+#endif
+#ifdef B600
+ { "600", B600 },
+#endif
+#ifdef B900
+ { "900", B900 },
+#endif
+#ifdef B1200
+ { "1200", B1200 },
+#endif
+#ifdef B1800
+ { "1800", B1800 },
+#endif
+#ifdef B2400
+ { "2400", B2400 },
+#endif
+#ifdef B3600
+ { "3600", B3600 },
+#endif
+#ifdef B4800
+ { "4800", B4800 },
+#endif
+#ifdef B7200
+ { "7200", B7200 },
+#endif
+#ifdef B9600
+ { "9600", B9600 },
+#endif
+#ifdef EXTA
+ { "19200", EXTA },
+#endif
+#ifdef B19200
+ { "19200", B19200 },
+#endif
+#ifdef EXTB
+ { "38400", EXTB },
+#endif
+#ifdef B38400
+ { "38400", B38400 },
+#endif
+ { NULL, 0 }
+};
+#endif
+
+private const struct termcapstr {
+ const char *name;
+ const char *long_name;
+} tstr[] = {
+#define T_al 0
+ { "al", "add new blank line" },
+#define T_bl 1
+ { "bl", "audible bell" },
+#define T_cd 2
+ { "cd", "clear to bottom" },
+#define T_ce 3
+ { "ce", "clear to end of line" },
+#define T_ch 4
+ { "ch", "cursor to horiz pos" },
+#define T_cl 5
+ { "cl", "clear screen" },
+#define T_dc 6
+ { "dc", "delete a character" },
+#define T_dl 7
+ { "dl", "delete a line" },
+#define T_dm 8
+ { "dm", "start delete mode" },
+#define T_ed 9
+ { "ed", "end delete mode" },
+#define T_ei 10
+ { "ei", "end insert mode" },
+#define T_fs 11
+ { "fs", "cursor from status line" },
+#define T_ho 12
+ { "ho", "home cursor" },
+#define T_ic 13
+ { "ic", "insert character" },
+#define T_im 14
+ { "im", "start insert mode" },
+#define T_ip 15
+ { "ip", "insert padding" },
+#define T_kd 16
+ { "kd", "sends cursor down" },
+#define T_kl 17
+ { "kl", "sends cursor left" },
+#define T_kr 18
+ { "kr", "sends cursor right" },
+#define T_ku 19
+ { "ku", "sends cursor up" },
+#define T_md 20
+ { "md", "begin bold" },
+#define T_me 21
+ { "me", "end attributes" },
+#define T_nd 22
+ { "nd", "non destructive space" },
+#define T_se 23
+ { "se", "end standout" },
+#define T_so 24
+ { "so", "begin standout" },
+#define T_ts 25
+ { "ts", "cursor to status line" },
+#define T_up 26
+ { "up", "cursor up one" },
+#define T_us 27
+ { "us", "begin underline" },
+#define T_ue 28
+ { "ue", "end underline" },
+#define T_vb 29
+ { "vb", "visible bell" },
+#define T_DC 30
+ { "DC", "delete multiple chars" },
+#define T_DO 31
+ { "DO", "cursor down multiple" },
+#define T_IC 32
+ { "IC", "insert multiple chars" },
+#define T_LE 33
+ { "LE", "cursor left multiple" },
+#define T_RI 34
+ { "RI", "cursor right multiple" },
+#define T_UP 35
+ { "UP", "cursor up multiple" },
+#define T_kh 36
+ { "kh", "send cursor home" },
+#define T_at7 37
+ { "@7", "send cursor end" },
+#define T_str 38
+ { NULL, NULL }
+};
+
+private const struct termcapval {
+ const char *name;
+ const char *long_name;
+} tval[] = {
+#define T_am 0
+ { "am", "has automatic margins" },
+#define T_pt 1
+ { "pt", "has physical tabs" },
+#define T_li 2
+ { "li", "Number of lines" },
+#define T_co 3
+ { "co", "Number of columns" },
+#define T_km 4
+ { "km", "Has meta key" },
+#define T_xt 5
+ { "xt", "Tab chars destructive" },
+#define T_xn 6
+ { "xn", "newline ignored at right margin" },
+#define T_MT 7
+ { "MT", "Has meta key" }, /* XXX? */
+#define T_val 8
+ { NULL, NULL, }
+};
+/* do two or more of the attributes use me */
+
+private void term_setflags(EditLine *);
+private int term_rebuffer_display(EditLine *);
+private void term_free_display(EditLine *);
+private int term_alloc_display(EditLine *);
+private void term_alloc(EditLine *, const struct termcapstr *, const char *);
+private void term_init_arrow(EditLine *);
+private void term_reset_arrow(EditLine *);
+
+
+private FILE *term_outfile = NULL; /* XXX: How do we fix that? */
+
+
+/* term_setflags():
+ * Set the terminal capability flags
+ */
+private void
+term_setflags(EditLine *el)
+{
+ EL_FLAGS = 0;
+ if (el->el_tty.t_tabs)
+ EL_FLAGS |= (Val(T_pt) && !Val(T_xt)) ? TERM_CAN_TAB : 0;
+
+ EL_FLAGS |= (Val(T_km) || Val(T_MT)) ? TERM_HAS_META : 0;
+ EL_FLAGS |= GoodStr(T_ce) ? TERM_CAN_CEOL : 0;
+ EL_FLAGS |= (GoodStr(T_dc) || GoodStr(T_DC)) ? TERM_CAN_DELETE : 0;
+ EL_FLAGS |= (GoodStr(T_im) || GoodStr(T_ic) || GoodStr(T_IC)) ?
+ TERM_CAN_INSERT : 0;
+ EL_FLAGS |= (GoodStr(T_up) || GoodStr(T_UP)) ? TERM_CAN_UP : 0;
+ EL_FLAGS |= Val(T_am) ? TERM_HAS_AUTO_MARGINS : 0;
+ EL_FLAGS |= Val(T_xn) ? TERM_HAS_MAGIC_MARGINS : 0;
+
+ if (GoodStr(T_me) && GoodStr(T_ue))
+ EL_FLAGS |= (strcmp(Str(T_me), Str(T_ue)) == 0) ?
+ TERM_CAN_ME : 0;
+ else
+ EL_FLAGS &= ~TERM_CAN_ME;
+ if (GoodStr(T_me) && GoodStr(T_se))
+ EL_FLAGS |= (strcmp(Str(T_me), Str(T_se)) == 0) ?
+ TERM_CAN_ME : 0;
+
+
+#ifdef DEBUG_SCREEN
+ if (!EL_CAN_UP) {
+ (void) fprintf(el->el_errfile,
+ "WARNING: Your terminal cannot move up.\n");
+ (void) fprintf(el->el_errfile,
+ "Editing may be odd for long lines.\n");
+ }
+ if (!EL_CAN_CEOL)
+ (void) fprintf(el->el_errfile, "no clear EOL capability.\n");
+ if (!EL_CAN_DELETE)
+ (void) fprintf(el->el_errfile, "no delete char capability.\n");
+ if (!EL_CAN_INSERT)
+ (void) fprintf(el->el_errfile, "no insert char capability.\n");
+#endif /* DEBUG_SCREEN */
+}
+
+
+/* term_init():
+ * Initialize the terminal stuff
+ */
+protected int
+term_init(EditLine *el)
+{
+
+ el->el_term.t_buf = (char *) el_malloc(TC_BUFSIZE);
+ if (el->el_term.t_buf == NULL)
+ return (-1);
+ el->el_term.t_cap = (char *) el_malloc(TC_BUFSIZE);
+ if (el->el_term.t_cap == NULL)
+ return (-1);
+ el->el_term.t_fkey = (fkey_t *) el_malloc(A_K_NKEYS * sizeof(fkey_t));
+ if (el->el_term.t_fkey == NULL)
+ return (-1);
+ el->el_term.t_loc = 0;
+ el->el_term.t_str = (char **) el_malloc(T_str * sizeof(char *));
+ if (el->el_term.t_str == NULL)
+ return (-1);
+ (void) memset(el->el_term.t_str, 0, T_str * sizeof(char *));
+ el->el_term.t_val = (int *) el_malloc(T_val * sizeof(int));
+ if (el->el_term.t_val == NULL)
+ return (-1);
+ (void) memset(el->el_term.t_val, 0, T_val * sizeof(int));
+ term_outfile = el->el_outfile;
+ (void) term_set(el, NULL);
+ term_init_arrow(el);
+ return (0);
+}
+
+/* term_end():
+ * Clean up the terminal stuff
+ */
+protected void
+term_end(EditLine *el)
+{
+
+ el_free((ptr_t) el->el_term.t_buf);
+ el->el_term.t_buf = NULL;
+ el_free((ptr_t) el->el_term.t_cap);
+ el->el_term.t_cap = NULL;
+ el->el_term.t_loc = 0;
+ el_free((ptr_t) el->el_term.t_str);
+ el->el_term.t_str = NULL;
+ el_free((ptr_t) el->el_term.t_val);
+ el->el_term.t_val = NULL;
+ el_free((ptr_t) el->el_term.t_fkey);
+ el->el_term.t_fkey = NULL;
+ term_free_display(el);
+}
+
+
+/* term_alloc():
+ * Maintain a string pool for termcap strings
+ */
+private void
+term_alloc(EditLine *el, const struct termcapstr *t, const char *cap)
+{
+ char termbuf[TC_BUFSIZE];
+ int tlen, clen;
+ char **tlist = el->el_term.t_str;
+ char **tmp, **str = &tlist[t - tstr];
+
+ if (cap == NULL || *cap == '\0') {
+ *str = NULL;
+ return;
+ } else
+ clen = strlen(cap);
+
+ tlen = *str == NULL ? 0 : strlen(*str);
+
+ /*
+ * New string is shorter; no need to allocate space
+ */
+ if (clen <= tlen) {
+ if (*str)
+ (void) strcpy(*str, cap); /* XXX strcpy is safe */
+ return;
+ }
+ /*
+ * New string is longer; see if we have enough space to append
+ */
+ if (el->el_term.t_loc + 3 < TC_BUFSIZE) {
+ /* XXX strcpy is safe */
+ (void) strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc],
+ cap);
+ el->el_term.t_loc += clen + 1; /* one for \0 */
+ return;
+ }
+ /*
+ * Compact our buffer; no need to check compaction, cause we know it
+ * fits...
+ */
+ tlen = 0;
+ for (tmp = tlist; tmp < &tlist[T_str]; tmp++)
+ if (*tmp != NULL && *tmp != '\0' && *tmp != *str) {
+ char *ptr;
+
+ for (ptr = *tmp; *ptr != '\0'; termbuf[tlen++] = *ptr++)
+ continue;
+ termbuf[tlen++] = '\0';
+ }
+ memcpy(el->el_term.t_buf, termbuf, TC_BUFSIZE);
+ el->el_term.t_loc = tlen;
+ if (el->el_term.t_loc + 3 >= TC_BUFSIZE) {
+ (void) fprintf(el->el_errfile,
+ "Out of termcap string space.\n");
+ return;
+ }
+ /* XXX strcpy is safe */
+ (void) strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap);
+ el->el_term.t_loc += clen + 1; /* one for \0 */
+ return;
+}
+
+
+/* term_rebuffer_display():
+ * Rebuffer the display after the screen changed size
+ */
+private int
+term_rebuffer_display(EditLine *el)
+{
+ coord_t *c = &el->el_term.t_size;
+
+ term_free_display(el);
+
+ c->h = Val(T_co);
+ c->v = Val(T_li);
+
+ if (term_alloc_display(el) == -1)
+ return (-1);
+ return (0);
+}
+
+
+/* term_alloc_display():
+ * Allocate a new display.
+ */
+private int
+term_alloc_display(EditLine *el)
+{
+ int i;
+ char **b;
+ coord_t *c = &el->el_term.t_size;
+
+ b = (char **) el_malloc((size_t) (sizeof(char *) * (c->v + 1)));
+ if (b == NULL)
+ return (-1);
+ for (i = 0; i < c->v; i++) {
+ b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1)));
+ if (b[i] == NULL) {
+ while (--i >= 0)
+ el_free((ptr_t) b[i]);
+ el_free((ptr_t) b);
+ return (-1);
+ }
+ }
+ b[c->v] = NULL;
+ el->el_display = b;
+
+ b = (char **) el_malloc((size_t) (sizeof(char *) * (c->v + 1)));
+ if (b == NULL)
+ return (-1);
+ for (i = 0; i < c->v; i++) {
+ b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1)));
+ if (b[i] == NULL) {
+ while (--i >= 0)
+ el_free((ptr_t) b[i]);
+ el_free((ptr_t) b);
+ return (-1);
+ }
+ }
+ b[c->v] = NULL;
+ el->el_vdisplay = b;
+ return (0);
+}
+
+
+/* term_free_display():
+ * Free the display buffers
+ */
+private void
+term_free_display(EditLine *el)
+{
+ char **b;
+ char **bufp;
+
+ b = el->el_display;
+ el->el_display = NULL;
+ if (b != NULL) {
+ for (bufp = b; *bufp != NULL; bufp++)
+ el_free((ptr_t) * bufp);
+ el_free((ptr_t) b);
+ }
+ b = el->el_vdisplay;
+ el->el_vdisplay = NULL;
+ if (b != NULL) {
+ for (bufp = b; *bufp != NULL; bufp++)
+ el_free((ptr_t) * bufp);
+ el_free((ptr_t) b);
+ }
+}
+
+
+/* term_move_to_line():
+ * move to line <where> (first line == 0)
+ * as efficiently as possible
+ */
+protected void
+term_move_to_line(EditLine *el, int where)
+{
+ int del;
+
+ if (where == el->el_cursor.v)
+ return;
+
+ if (where > el->el_term.t_size.v) {
+#ifdef DEBUG_SCREEN
+ (void) fprintf(el->el_errfile,
+ "term_move_to_line: where is ridiculous: %d\r\n", where);
+#endif /* DEBUG_SCREEN */
+ return;
+ }
+ if ((del = where - el->el_cursor.v) > 0) {
+ while (del > 0) {
+ if (EL_HAS_AUTO_MARGINS &&
+ el->el_display[el->el_cursor.v][0] != '\0') {
+ /* move without newline */
+ term_move_to_char(el, el->el_term.t_size.h - 1);
+ term_overwrite(el,
+ &el->el_display[el->el_cursor.v][el->el_cursor.h],
+ 1);
+ /* updates Cursor */
+ del--;
+ } else {
+ if ((del > 1) && GoodStr(T_DO)) {
+ (void) tputs(tgoto(Str(T_DO), del, del),
+ del, term__putc);
+ del = 0;
+ } else {
+ for (; del > 0; del--)
+ term__putc('\n');
+ /* because the \n will become \r\n */
+ el->el_cursor.h = 0;
+ }
+ }
+ }
+ } else { /* del < 0 */
+ if (GoodStr(T_UP) && (-del > 1 || !GoodStr(T_up)))
+ (void) tputs(tgoto(Str(T_UP), -del, -del), -del,
+ term__putc);
+ else {
+ if (GoodStr(T_up))
+ for (; del < 0; del++)
+ (void) tputs(Str(T_up), 1, term__putc);
+ }
+ }
+ el->el_cursor.v = where;/* now where is here */
+}
+
+
+/* term_move_to_char():
+ * Move to the character position specified
+ */
+protected void
+term_move_to_char(EditLine *el, int where)
+{
+ int del, i;
+
+mc_again:
+ if (where == el->el_cursor.h)
+ return;
+
+ if (where > el->el_term.t_size.h) {
+#ifdef DEBUG_SCREEN
+ (void) fprintf(el->el_errfile,
+ "term_move_to_char: where is riduculous: %d\r\n", where);
+#endif /* DEBUG_SCREEN */
+ return;
+ }
+ if (!where) { /* if where is first column */
+ term__putc('\r'); /* do a CR */
+ el->el_cursor.h = 0;
+ return;
+ }
+ del = where - el->el_cursor.h;
+
+ if ((del < -4 || del > 4) && GoodStr(T_ch))
+ /* go there directly */
+ (void) tputs(tgoto(Str(T_ch), where, where), where, term__putc);
+ else {
+ if (del > 0) { /* moving forward */
+ if ((del > 4) && GoodStr(T_RI))
+ (void) tputs(tgoto(Str(T_RI), del, del),
+ del, term__putc);
+ else {
+ /* if I can do tabs, use them */
+ if (EL_CAN_TAB) {
+ if ((el->el_cursor.h & 0370) !=
+ (where & 0370)) {
+ /* if not within tab stop */
+ for (i =
+ (el->el_cursor.h & 0370);
+ i < (where & 0370);
+ i += 8)
+ term__putc('\t');
+ /* then tab over */
+ el->el_cursor.h = where & 0370;
+ }
+ }
+ /*
+ * it's usually cheaper to just write the
+ * chars, so we do.
+ */
+ /*
+ * NOTE THAT term_overwrite() WILL CHANGE
+ * el->el_cursor.h!!!
+ */
+ term_overwrite(el,
+ &el->el_display[el->el_cursor.v][el->el_cursor.h],
+ where - el->el_cursor.h);
+
+ }
+ } else { /* del < 0 := moving backward */
+ if ((-del > 4) && GoodStr(T_LE))
+ (void) tputs(tgoto(Str(T_LE), -del, -del),
+ -del, term__putc);
+ else { /* can't go directly there */
+ /*
+ * if the "cost" is greater than the "cost"
+ * from col 0
+ */
+ if (EL_CAN_TAB ?
+ ((unsigned int)-del >
+ (((unsigned int) where >> 3) +
+ (where & 07)))
+ : (-del > where)) {
+ term__putc('\r'); /* do a CR */
+ el->el_cursor.h = 0;
+ goto mc_again; /* and try again */
+ }
+ for (i = 0; i < -del; i++)
+ term__putc('\b');
+ }
+ }
+ }
+ el->el_cursor.h = where; /* now where is here */
+}
+
+
+/* term_overwrite():
+ * Overstrike num characters
+ */
+protected void
+term_overwrite(EditLine *el, const char *cp, int n)
+{
+ if (n <= 0)
+ return; /* catch bugs */
+
+ if (n > el->el_term.t_size.h) {
+#ifdef DEBUG_SCREEN
+ (void) fprintf(el->el_errfile,
+ "term_overwrite: n is riduculous: %d\r\n", n);
+#endif /* DEBUG_SCREEN */
+ return;
+ }
+ do {
+ term__putc(*cp++);
+ el->el_cursor.h++;
+ } while (--n);
+
+ if (el->el_cursor.h >= el->el_term.t_size.h) { /* wrap? */
+ if (EL_HAS_AUTO_MARGINS) { /* yes */
+ el->el_cursor.h = 0;
+ el->el_cursor.v++;
+ if (EL_HAS_MAGIC_MARGINS) {
+ /* force the wrap to avoid the "magic"
+ * situation */
+ char c;
+ if ((c = el->el_display[el->el_cursor.v][el->el_cursor.h])
+ != '\0')
+ term_overwrite(el, &c, 1);
+ else
+ term__putc(' ');
+ el->el_cursor.h = 1;
+ }
+ } else /* no wrap, but cursor stays on screen */
+ el->el_cursor.h = el->el_term.t_size.h;
+ }
+}
+
+
+/* term_deletechars():
+ * Delete num characters
+ */
+protected void
+term_deletechars(EditLine *el, int num)
+{
+ if (num <= 0)
+ return;
+
+ if (!EL_CAN_DELETE) {
+#ifdef DEBUG_EDIT
+ (void) fprintf(el->el_errfile, " ERROR: cannot delete \n");
+#endif /* DEBUG_EDIT */
+ return;
+ }
+ if (num > el->el_term.t_size.h) {
+#ifdef DEBUG_SCREEN
+ (void) fprintf(el->el_errfile,
+ "term_deletechars: num is riduculous: %d\r\n", num);
+#endif /* DEBUG_SCREEN */
+ return;
+ }
+ if (GoodStr(T_DC)) /* if I have multiple delete */
+ if ((num > 1) || !GoodStr(T_dc)) { /* if dc would be more
+ * expen. */
+ (void) tputs(tgoto(Str(T_DC), num, num),
+ num, term__putc);
+ return;
+ }
+ if (GoodStr(T_dm)) /* if I have delete mode */
+ (void) tputs(Str(T_dm), 1, term__putc);
+
+ if (GoodStr(T_dc)) /* else do one at a time */
+ while (num--)
+ (void) tputs(Str(T_dc), 1, term__putc);
+
+ if (GoodStr(T_ed)) /* if I have delete mode */
+ (void) tputs(Str(T_ed), 1, term__putc);
+}
+
+
+/* term_insertwrite():
+ * Puts terminal in insert character mode or inserts num
+ * characters in the line
+ */
+protected void
+term_insertwrite(EditLine *el, char *cp, int num)
+{
+ if (num <= 0)
+ return;
+ if (!EL_CAN_INSERT) {
+#ifdef DEBUG_EDIT
+ (void) fprintf(el->el_errfile, " ERROR: cannot insert \n");
+#endif /* DEBUG_EDIT */
+ return;
+ }
+ if (num > el->el_term.t_size.h) {
+#ifdef DEBUG_SCREEN
+ (void) fprintf(el->el_errfile,
+ "StartInsert: num is riduculous: %d\r\n", num);
+#endif /* DEBUG_SCREEN */
+ return;
+ }
+ if (GoodStr(T_IC)) /* if I have multiple insert */
+ if ((num > 1) || !GoodStr(T_ic)) {
+ /* if ic would be more expensive */
+ (void) tputs(tgoto(Str(T_IC), num, num),
+ num, term__putc);
+ term_overwrite(el, cp, num);
+ /* this updates el_cursor.h */
+ return;
+ }
+ if (GoodStr(T_im) && GoodStr(T_ei)) { /* if I have insert mode */
+ (void) tputs(Str(T_im), 1, term__putc);
+
+ el->el_cursor.h += num;
+ do
+ term__putc(*cp++);
+ while (--num);
+
+ if (GoodStr(T_ip)) /* have to make num chars insert */
+ (void) tputs(Str(T_ip), 1, term__putc);
+
+ (void) tputs(Str(T_ei), 1, term__putc);
+ return;
+ }
+ do {
+ if (GoodStr(T_ic)) /* have to make num chars insert */
+ (void) tputs(Str(T_ic), 1, term__putc);
+ /* insert a char */
+
+ term__putc(*cp++);
+
+ el->el_cursor.h++;
+
+ if (GoodStr(T_ip)) /* have to make num chars insert */
+ (void) tputs(Str(T_ip), 1, term__putc);
+ /* pad the inserted char */
+
+ } while (--num);
+}
+
+
+/* term_clear_EOL():
+ * clear to end of line. There are num characters to clear
+ */
+protected void
+term_clear_EOL(EditLine *el, int num)
+{
+ int i;
+
+ if (EL_CAN_CEOL && GoodStr(T_ce))
+ (void) tputs(Str(T_ce), 1, term__putc);
+ else {
+ for (i = 0; i < num; i++)
+ term__putc(' ');
+ el->el_cursor.h += num; /* have written num spaces */
+ }
+}
+
+
+/* term_clear_screen():
+ * Clear the screen
+ */
+protected void
+term_clear_screen(EditLine *el)
+{ /* clear the whole screen and home */
+
+ if (GoodStr(T_cl))
+ /* send the clear screen code */
+ (void) tputs(Str(T_cl), Val(T_li), term__putc);
+ else if (GoodStr(T_ho) && GoodStr(T_cd)) {
+ (void) tputs(Str(T_ho), Val(T_li), term__putc); /* home */
+ /* clear to bottom of screen */
+ (void) tputs(Str(T_cd), Val(T_li), term__putc);
+ } else {
+ term__putc('\r');
+ term__putc('\n');
+ }
+}
+
+
+/* term_beep():
+ * Beep the way the terminal wants us
+ */
+protected void
+term_beep(EditLine *el)
+{
+ if (GoodStr(T_bl))
+ /* what termcap says we should use */
+ (void) tputs(Str(T_bl), 1, term__putc);
+ else
+ term__putc('\007'); /* an ASCII bell; ^G */
+}
+
+
+#ifdef notdef
+/* term_clear_to_bottom():
+ * Clear to the bottom of the screen
+ */
+protected void
+term_clear_to_bottom(EditLine *el)
+{
+ if (GoodStr(T_cd))
+ (void) tputs(Str(T_cd), Val(T_li), term__putc);
+ else if (GoodStr(T_ce))
+ (void) tputs(Str(T_ce), Val(T_li), term__putc);
+}
+#endif
+
+protected void
+term_get(EditLine *el, const char **term)
+{
+ *term = el->el_term.t_name;
+}
+
+
+/* term_set():
+ * Read in the terminal capabilities from the requested terminal
+ */
+protected int
+term_set(EditLine *el, const char *term)
+{
+ int i;
+ char buf[TC_BUFSIZE];
+ char *area;
+ const struct termcapstr *t;
+ sigset_t oset, nset;
+ int lins, cols;
+
+ (void) sigemptyset(&nset);
+ (void) sigaddset(&nset, SIGWINCH);
+ (void) sigprocmask(SIG_BLOCK, &nset, &oset);
+
+ area = buf;
+
+
+ if (term == NULL)
+ term = getenv("TERM");
+
+ if (!term || !term[0])
+ term = "dumb";
+
+ if (strcmp(term, "emacs") == 0)
+ el->el_flags |= EDIT_DISABLED;
+
+ memset(el->el_term.t_cap, 0, TC_BUFSIZE);
+
+ i = tgetent(el->el_term.t_cap, term);
+
+ if (i <= 0) {
+ if (i == -1)
+ (void) fprintf(el->el_errfile,
+ "Cannot read termcap database;\n");
+ else if (i == 0)
+ (void) fprintf(el->el_errfile,
+ "No entry for terminal type \"%s\";\n", term);
+ (void) fprintf(el->el_errfile,
+ "using dumb terminal settings.\n");
+ Val(T_co) = 80; /* do a dumb terminal */
+ Val(T_pt) = Val(T_km) = Val(T_li) = 0;
+ Val(T_xt) = Val(T_MT);
+ for (t = tstr; t->name != NULL; t++)
+ term_alloc(el, t, NULL);
+ } else {
+ /* auto/magic margins */
+ Val(T_am) = tgetflag("am");
+ Val(T_xn) = tgetflag("xn");
+ /* Can we tab */
+ Val(T_pt) = tgetflag("pt");
+ Val(T_xt) = tgetflag("xt");
+ /* do we have a meta? */
+ Val(T_km) = tgetflag("km");
+ Val(T_MT) = tgetflag("MT");
+ /* Get the size */
+ Val(T_co) = tgetnum("co");
+ Val(T_li) = tgetnum("li");
+ for (t = tstr; t->name != NULL; t++) {
+ /* XXX: some systems' tgetstr needs non const */
+ term_alloc(el, t, tgetstr(strchr(t->name, *t->name),
+ &area));
+ }
+ }
+
+ if (Val(T_co) < 2)
+ Val(T_co) = 80; /* just in case */
+ if (Val(T_li) < 1)
+ Val(T_li) = 24;
+
+ el->el_term.t_size.v = Val(T_co);
+ el->el_term.t_size.h = Val(T_li);
+
+ term_setflags(el);
+
+ /* get the correct window size */
+ (void) term_get_size(el, &lins, &cols);
+ if (term_change_size(el, lins, cols) == -1)
+ return (-1);
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+ term_bind_arrow(el);
+ el->el_term.t_name = term;
+ return (i <= 0 ? -1 : 0);
+}
+
+
+/* term_get_size():
+ * Return the new window size in lines and cols, and
+ * true if the size was changed.
+ */
+protected int
+term_get_size(EditLine *el, int *lins, int *cols)
+{
+
+ *cols = Val(T_co);
+ *lins = Val(T_li);
+
+#ifdef TIOCGWINSZ
+ {
+ struct winsize ws;
+ if (ioctl(el->el_infd, TIOCGWINSZ, (ioctl_t) & ws) != -1) {
+ if (ws.ws_col)
+ *cols = ws.ws_col;
+ if (ws.ws_row)
+ *lins = ws.ws_row;
+ }
+ }
+#endif
+#ifdef TIOCGSIZE
+ {
+ struct ttysize ts;
+ if (ioctl(el->el_infd, TIOCGSIZE, (ioctl_t) & ts) != -1) {
+ if (ts.ts_cols)
+ *cols = ts.ts_cols;
+ if (ts.ts_lines)
+ *lins = ts.ts_lines;
+ }
+ }
+#endif
+ return (Val(T_co) != *cols || Val(T_li) != *lins);
+}
+
+
+/* term_change_size():
+ * Change the size of the terminal
+ */
+protected int
+term_change_size(EditLine *el, int lins, int cols)
+{
+ /*
+ * Just in case
+ */
+ Val(T_co) = (cols < 2) ? 80 : cols;
+ Val(T_li) = (lins < 1) ? 24 : lins;
+
+ /* re-make display buffers */
+ if (term_rebuffer_display(el) == -1)
+ return (-1);
+ re_clear_display(el);
+ return (0);
+}
+
+
+/* term_init_arrow():
+ * Initialize the arrow key bindings from termcap
+ */
+private void
+term_init_arrow(EditLine *el)
+{
+ fkey_t *arrow = el->el_term.t_fkey;
+
+ arrow[A_K_DN].name = "down";
+ arrow[A_K_DN].key = T_kd;
+ arrow[A_K_DN].fun.cmd = ED_NEXT_HISTORY;
+ arrow[A_K_DN].type = XK_CMD;
+
+ arrow[A_K_UP].name = "up";
+ arrow[A_K_UP].key = T_ku;
+ arrow[A_K_UP].fun.cmd = ED_PREV_HISTORY;
+ arrow[A_K_UP].type = XK_CMD;
+
+ arrow[A_K_LT].name = "left";
+ arrow[A_K_LT].key = T_kl;
+ arrow[A_K_LT].fun.cmd = ED_PREV_CHAR;
+ arrow[A_K_LT].type = XK_CMD;
+
+ arrow[A_K_RT].name = "right";
+ arrow[A_K_RT].key = T_kr;
+ arrow[A_K_RT].fun.cmd = ED_NEXT_CHAR;
+ arrow[A_K_RT].type = XK_CMD;
+
+ arrow[A_K_HO].name = "home";
+ arrow[A_K_HO].key = T_kh;
+ arrow[A_K_HO].fun.cmd = ED_MOVE_TO_BEG;
+ arrow[A_K_HO].type = XK_CMD;
+
+ arrow[A_K_EN].name = "end";
+ arrow[A_K_EN].key = T_at7;
+ arrow[A_K_EN].fun.cmd = ED_MOVE_TO_END;
+ arrow[A_K_EN].type = XK_CMD;
+}
+
+
+/* term_reset_arrow():
+ * Reset arrow key bindings
+ */
+private void
+term_reset_arrow(EditLine *el)
+{
+ fkey_t *arrow = el->el_term.t_fkey;
+ static const char strA[] = {033, '[', 'A', '\0'};
+ static const char strB[] = {033, '[', 'B', '\0'};
+ static const char strC[] = {033, '[', 'C', '\0'};
+ static const char strD[] = {033, '[', 'D', '\0'};
+ static const char strH[] = {033, '[', 'H', '\0'};
+ static const char strF[] = {033, '[', 'F', '\0'};
+ static const char stOA[] = {033, 'O', 'A', '\0'};
+ static const char stOB[] = {033, 'O', 'B', '\0'};
+ static const char stOC[] = {033, 'O', 'C', '\0'};
+ static const char stOD[] = {033, 'O', 'D', '\0'};
+ static const char stOH[] = {033, 'O', 'H', '\0'};
+ static const char stOF[] = {033, 'O', 'F', '\0'};
+
+ key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+ key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+ key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+ key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+ key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
+ key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
+ key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+ key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+ key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+ key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+ key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
+ key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
+
+ if (el->el_map.type == MAP_VI) {
+ key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+ key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+ key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+ key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+ key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
+ key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
+ key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
+ key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
+ key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
+ key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
+ key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
+ key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
+ }
+}
+
+
+/* term_set_arrow():
+ * Set an arrow key binding
+ */
+protected int
+term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type)
+{
+ fkey_t *arrow = el->el_term.t_fkey;
+ int i;
+
+ for (i = 0; i < A_K_NKEYS; i++)
+ if (strcmp(name, arrow[i].name) == 0) {
+ arrow[i].fun = *fun;
+ arrow[i].type = type;
+ return (0);
+ }
+ return (-1);
+}
+
+
+/* term_clear_arrow():
+ * Clear an arrow key binding
+ */
+protected int
+term_clear_arrow(EditLine *el, const char *name)
+{
+ fkey_t *arrow = el->el_term.t_fkey;
+ int i;
+
+ for (i = 0; i < A_K_NKEYS; i++)
+ if (strcmp(name, arrow[i].name) == 0) {
+ arrow[i].type = XK_NOD;
+ return (0);
+ }
+ return (-1);
+}
+
+
+/* term_print_arrow():
+ * Print the arrow key bindings
+ */
+protected void
+term_print_arrow(EditLine *el, const char *name)
+{
+ int i;
+ fkey_t *arrow = el->el_term.t_fkey;
+
+ for (i = 0; i < A_K_NKEYS; i++)
+ if (*name == '\0' || strcmp(name, arrow[i].name) == 0)
+ if (arrow[i].type != XK_NOD)
+ key_kprint(el, arrow[i].name, &arrow[i].fun,
+ arrow[i].type);
+}
+
+
+/* term_bind_arrow():
+ * Bind the arrow keys
+ */
+protected void
+term_bind_arrow(EditLine *el)
+{
+ el_action_t *map;
+ const el_action_t *dmap;
+ int i, j;
+ char *p;
+ fkey_t *arrow = el->el_term.t_fkey;
+
+ /* Check if the components needed are initialized */
+ if (el->el_term.t_buf == NULL || el->el_map.key == NULL)
+ return;
+
+ map = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key;
+ dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs;
+
+ term_reset_arrow(el);
+
+ for (i = 0; i < A_K_NKEYS; i++) {
+ p = el->el_term.t_str[arrow[i].key];
+ if (p && *p) {
+ j = (unsigned char) *p;
+ /*
+ * Assign the arrow keys only if:
+ *
+ * 1. They are multi-character arrow keys and the user
+ * has not re-assigned the leading character, or
+ * has re-assigned the leading character to be
+ * ED_SEQUENCE_LEAD_IN
+ * 2. They are single arrow keys pointing to an
+ * unassigned key.
+ */
+ if (arrow[i].type == XK_NOD)
+ key_clear(el, map, p);
+ else {
+ if (p[1] && (dmap[j] == map[j] ||
+ map[j] == ED_SEQUENCE_LEAD_IN)) {
+ key_add(el, p, &arrow[i].fun,
+ arrow[i].type);
+ map[j] = ED_SEQUENCE_LEAD_IN;
+ } else if (map[j] == ED_UNASSIGNED) {
+ key_clear(el, map, p);
+ if (arrow[i].type == XK_CMD)
+ map[j] = arrow[i].fun.cmd;
+ else
+ key_add(el, p, &arrow[i].fun,
+ arrow[i].type);
+ }
+ }
+ }
+ }
+}
+
+
+/* term__putc():
+ * Add a character
+ */
+protected int
+term__putc(int c)
+{
+
+ return (fputc(c, term_outfile));
+}
+
+
+/* term__flush():
+ * Flush output
+ */
+protected void
+term__flush(void)
+{
+
+ (void) fflush(term_outfile);
+}
+
+/* term_writec():
+ * Write the given character out, in a human readable form
+ */
+protected void
+term_writec(EditLine *el, int c)
+{
+ char buf[8];
+ int cnt = key__decode_char(buf, sizeof(buf), 0, c);
+ buf[cnt] = '\0';
+ term_overwrite(el, buf, cnt);
+ term__flush();
+}
+
+
+/* term_telltc():
+ * Print the current termcap characteristics
+ */
+protected int
+/*ARGSUSED*/
+term_telltc(EditLine *el, int argc __attribute__((__unused__)),
+ const char **argv __attribute__((__unused__)))
+{
+ const struct termcapstr *t;
+ char **ts;
+ char upbuf[EL_BUFSIZ];
+
+ (void) fprintf(el->el_outfile, "\n\tYour terminal has the\n");
+ (void) fprintf(el->el_outfile, "\tfollowing characteristics:\n\n");
+ (void) fprintf(el->el_outfile, "\tIt has %d columns and %d lines\n",
+ Val(T_co), Val(T_li));
+ (void) fprintf(el->el_outfile,
+ "\tIt has %s meta key\n", EL_HAS_META ? "a" : "no");
+ (void) fprintf(el->el_outfile,
+ "\tIt can%suse tabs\n", EL_CAN_TAB ? " " : "not ");
+ (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n",
+ EL_HAS_AUTO_MARGINS ? "has" : "does not have");
+ if (EL_HAS_AUTO_MARGINS)
+ (void) fprintf(el->el_outfile, "\tIt %s magic margins\n",
+ EL_HAS_MAGIC_MARGINS ? "has" : "does not have");
+
+ for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) {
+ const char *ub;
+ if (*ts && **ts) {
+ (void) key__decode_str(*ts, upbuf, sizeof(upbuf), "");
+ ub = upbuf;
+ } else {
+ ub = "(empty)";
+ }
+ (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
+ t->long_name, t->name, ub);
+ }
+ (void) fputc('\n', el->el_outfile);
+ return (0);
+}
+
+
+/* term_settc():
+ * Change the current terminal characteristics
+ */
+protected int
+/*ARGSUSED*/
+term_settc(EditLine *el, int argc __attribute__((__unused__)),
+ const char **argv)
+{
+ const struct termcapstr *ts;
+ const struct termcapval *tv;
+ const char *what, *how;
+
+ if (argv == NULL || argv[1] == NULL || argv[2] == NULL)
+ return (-1);
+
+ what = argv[1];
+ how = argv[2];
+
+ /*
+ * Do the strings first
+ */
+ for (ts = tstr; ts->name != NULL; ts++)
+ if (strcmp(ts->name, what) == 0)
+ break;
+
+ if (ts->name != NULL) {
+ term_alloc(el, ts, how);
+ term_setflags(el);
+ return (0);
+ }
+ /*
+ * Do the numeric ones second
+ */
+ for (tv = tval; tv->name != NULL; tv++)
+ if (strcmp(tv->name, what) == 0)
+ break;
+
+ if (tv->name != NULL) {
+ if (tv == &tval[T_pt] || tv == &tval[T_km] ||
+ tv == &tval[T_am] || tv == &tval[T_xn]) {
+ if (strcmp(how, "yes") == 0)
+ el->el_term.t_val[tv - tval] = 1;
+ else if (strcmp(how, "no") == 0)
+ el->el_term.t_val[tv - tval] = 0;
+ else {
+ (void) fprintf(el->el_errfile,
+ "settc: Bad value `%s'.\n", how);
+ return (-1);
+ }
+ term_setflags(el);
+ if (term_change_size(el, Val(T_li), Val(T_co)) == -1)
+ return (-1);
+ return (0);
+ } else {
+ long i;
+ char *ep;
+
+ i = strtol(how, &ep, 10);
+ if (*ep != '\0') {
+ (void) fprintf(el->el_errfile,
+ "settc: Bad value `%s'.\n", how);
+ return (-1);
+ }
+ el->el_term.t_val[tv - tval] = (int) i;
+ el->el_term.t_size.v = Val(T_co);
+ el->el_term.t_size.h = Val(T_li);
+ if (tv == &tval[T_co] || tv == &tval[T_li])
+ if (term_change_size(el, Val(T_li), Val(T_co))
+ == -1)
+ return (-1);
+ return (0);
+ }
+ }
+ return (-1);
+}
+
+
+/* term_echotc():
+ * Print the termcap string out with variable substitution
+ */
+protected int
+/*ARGSUSED*/
+term_echotc(EditLine *el, int argc __attribute__((__unused__)),
+ const char **argv)
+{
+ char *cap, *scap, *ep;
+ int arg_need, arg_cols, arg_rows;
+ int verbose = 0, silent = 0;
+ char *area;
+ static const char fmts[] = "%s\n", fmtd[] = "%d\n";
+ const struct termcapstr *t;
+ char buf[TC_BUFSIZE];
+ long i;
+
+ area = buf;
+
+ if (argv == NULL || argv[1] == NULL)
+ return (-1);
+ argv++;
+
+ if (argv[0][0] == '-') {
+ switch (argv[0][1]) {
+ case 'v':
+ verbose = 1;
+ break;
+ case 's':
+ silent = 1;
+ break;
+ default:
+ /* stderror(ERR_NAME | ERR_TCUSAGE); */
+ break;
+ }
+ argv++;
+ }
+ if (!*argv || *argv[0] == '\0')
+ return (0);
+ if (strcmp(*argv, "tabs") == 0) {
+ (void) fprintf(el->el_outfile, fmts, EL_CAN_TAB ? "yes" : "no");
+ return (0);
+ } else if (strcmp(*argv, "meta") == 0) {
+ (void) fprintf(el->el_outfile, fmts, Val(T_km) ? "yes" : "no");
+ return (0);
+ } else if (strcmp(*argv, "xn") == 0) {
+ (void) fprintf(el->el_outfile, fmts, EL_HAS_MAGIC_MARGINS ?
+ "yes" : "no");
+ return (0);
+ } else if (strcmp(*argv, "am") == 0) {
+ (void) fprintf(el->el_outfile, fmts, EL_HAS_AUTO_MARGINS ?
+ "yes" : "no");
+ return (0);
+ } else if (strcmp(*argv, "baud") == 0) {
+#ifdef notdef
+ int i;
+
+ for (i = 0; baud_rate[i].b_name != NULL; i++)
+ if (el->el_tty.t_speed == baud_rate[i].b_rate) {
+ (void) fprintf(el->el_outfile, fmts,
+ baud_rate[i].b_name);
+ return (0);
+ }
+ (void) fprintf(el->el_outfile, fmtd, 0);
+#else
+ (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed);
+#endif
+ return (0);
+ } else if (strcmp(*argv, "rows") == 0 || strcmp(*argv, "lines") == 0) {
+ (void) fprintf(el->el_outfile, fmtd, Val(T_li));
+ return (0);
+ } else if (strcmp(*argv, "cols") == 0) {
+ (void) fprintf(el->el_outfile, fmtd, Val(T_co));
+ return (0);
+ }
+ /*
+ * Try to use our local definition first
+ */
+ scap = NULL;
+ for (t = tstr; t->name != NULL; t++)
+ if (strcmp(t->name, *argv) == 0) {
+ scap = el->el_term.t_str[t - tstr];
+ break;
+ }
+ if (t->name == NULL) {
+ /* XXX: some systems' tgetstr needs non const */
+ scap = tgetstr(strchr(*argv, **argv), &area);
+ }
+ if (!scap || scap[0] == '\0') {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Termcap parameter `%s' not found.\n",
+ *argv);
+ return (-1);
+ }
+ /*
+ * Count home many values we need for this capability.
+ */
+ for (cap = scap, arg_need = 0; *cap; cap++)
+ if (*cap == '%')
+ switch (*++cap) {
+ case 'd':
+ case '2':
+ case '3':
+ case '.':
+ case '+':
+ arg_need++;
+ break;
+ case '%':
+ case '>':
+ case 'i':
+ case 'r':
+ case 'n':
+ case 'B':
+ case 'D':
+ break;
+ default:
+ /*
+ * hpux has lot's of them...
+ */
+ if (verbose)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: unknown termcap %% `%c'.\n",
+ *cap);
+ /* This is bad, but I won't complain */
+ break;
+ }
+
+ switch (arg_need) {
+ case 0:
+ argv++;
+ if (*argv && *argv[0]) {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Extra argument `%s'.\n",
+ *argv);
+ return (-1);
+ }
+ (void) tputs(scap, 1, term__putc);
+ break;
+ case 1:
+ argv++;
+ if (!*argv || *argv[0] == '\0') {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Missing argument.\n");
+ return (-1);
+ }
+ arg_cols = 0;
+ i = strtol(*argv, &ep, 10);
+ if (*ep != '\0' || i < 0) {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Bad value `%s' for rows.\n",
+ *argv);
+ return (-1);
+ }
+ arg_rows = (int) i;
+ argv++;
+ if (*argv && *argv[0]) {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Extra argument `%s'.\n",
+ *argv);
+ return (-1);
+ }
+ (void) tputs(tgoto(scap, arg_cols, arg_rows), 1, term__putc);
+ break;
+ default:
+ /* This is wrong, but I will ignore it... */
+ if (verbose)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Too many required arguments (%d).\n",
+ arg_need);
+ /* FALLTHROUGH */
+ case 2:
+ argv++;
+ if (!*argv || *argv[0] == '\0') {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Missing argument.\n");
+ return (-1);
+ }
+ i = strtol(*argv, &ep, 10);
+ if (*ep != '\0' || i < 0) {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Bad value `%s' for cols.\n",
+ *argv);
+ return (-1);
+ }
+ arg_cols = (int) i;
+ argv++;
+ if (!*argv || *argv[0] == '\0') {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Missing argument.\n");
+ return (-1);
+ }
+ i = strtol(*argv, &ep, 10);
+ if (*ep != '\0' || i < 0) {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Bad value `%s' for rows.\n",
+ *argv);
+ return (-1);
+ }
+ arg_rows = (int) i;
+ if (*ep != '\0') {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Bad value `%s'.\n", *argv);
+ return (-1);
+ }
+ argv++;
+ if (*argv && *argv[0]) {
+ if (!silent)
+ (void) fprintf(el->el_errfile,
+ "echotc: Warning: Extra argument `%s'.\n",
+ *argv);
+ return (-1);
+ }
+ (void) tputs(tgoto(scap, arg_cols, arg_rows), arg_rows,
+ term__putc);
+ break;
+ }
+ return (0);
+}
diff --git a/frontend/libedit/term.h b/frontend/libedit/term.h
new file mode 100644
index 0000000..24b1ef8
--- /dev/null
+++ b/frontend/libedit/term.h
@@ -0,0 +1,122 @@
+/* $NetBSD: term.h,v 1.15 2003/09/14 21:48:55 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)term.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.term.h: Termcap header
+ */
+#ifndef _h_el_term
+#define _h_el_term
+
+#include "histedit.h"
+
+typedef struct { /* Symbolic function key bindings */
+ const char *name; /* name of the key */
+ int key; /* Index in termcap table */
+ key_value_t fun; /* Function bound to it */
+ int type; /* Type of function */
+} fkey_t;
+
+typedef struct {
+ const char *t_name; /* the terminal name */
+ coord_t t_size; /* # lines and cols */
+ int t_flags;
+#define TERM_CAN_INSERT 0x001 /* Has insert cap */
+#define TERM_CAN_DELETE 0x002 /* Has delete cap */
+#define TERM_CAN_CEOL 0x004 /* Has CEOL cap */
+#define TERM_CAN_TAB 0x008 /* Can use tabs */
+#define TERM_CAN_ME 0x010 /* Can turn all attrs. */
+#define TERM_CAN_UP 0x020 /* Can move up */
+#define TERM_HAS_META 0x040 /* Has a meta key */
+#define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */
+#define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */
+ char *t_buf; /* Termcap buffer */
+ int t_loc; /* location used */
+ char **t_str; /* termcap strings */
+ int *t_val; /* termcap values */
+ char *t_cap; /* Termcap buffer */
+ fkey_t *t_fkey; /* Array of keys */
+} el_term_t;
+
+/*
+ * fKey indexes
+ */
+#define A_K_DN 0
+#define A_K_UP 1
+#define A_K_LT 2
+#define A_K_RT 3
+#define A_K_HO 4
+#define A_K_EN 5
+#define A_K_NKEYS 6
+
+protected void term_move_to_line(EditLine *, int);
+protected void term_move_to_char(EditLine *, int);
+protected void term_clear_EOL(EditLine *, int);
+protected void term_overwrite(EditLine *, const char *, int);
+protected void term_insertwrite(EditLine *, char *, int);
+protected void term_deletechars(EditLine *, int);
+protected void term_clear_screen(EditLine *);
+protected void term_beep(EditLine *);
+protected int term_change_size(EditLine *, int, int);
+protected int term_get_size(EditLine *, int *, int *);
+protected int term_init(EditLine *);
+protected void term_bind_arrow(EditLine *);
+protected void term_print_arrow(EditLine *, const char *);
+protected int term_clear_arrow(EditLine *, const char *);
+protected int term_set_arrow(EditLine *, const char *, key_value_t *, int);
+protected void term_end(EditLine *);
+protected void term_get(EditLine *, const char **);
+protected int term_set(EditLine *, const char *);
+protected int term_settc(EditLine *, int, const char **);
+protected int term_telltc(EditLine *, int, const char **);
+protected int term_echotc(EditLine *, int, const char **);
+protected int term__putc(int);
+protected void term__flush(void);
+
+/*
+ * Easy access macros
+ */
+#define EL_FLAGS (el)->el_term.t_flags
+
+#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT)
+#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE)
+#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL)
+#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB)
+#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME)
+#define EL_HAS_META (EL_FLAGS & TERM_HAS_META)
+#define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS)
+#define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS)
+
+#endif /* _h_el_term */
diff --git a/frontend/libedit/tokenizer.c b/frontend/libedit/tokenizer.c
new file mode 100644
index 0000000..177633b
--- /dev/null
+++ b/frontend/libedit/tokenizer.c
@@ -0,0 +1,441 @@
+/* $NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * tokenize.c: Bourne shell like tokenizer
+ */
+#include <string.h>
+#include <stdlib.h>
+#include "histedit.h"
+
+typedef enum {
+ Q_none, Q_single, Q_double, Q_one, Q_doubleone
+} quote_t;
+
+#define IFS "\t \n"
+
+#define TOK_KEEP 1
+#define TOK_EAT 2
+
+#define WINCR 20
+#define AINCR 10
+
+#define tok_strdup(a) strdup(a)
+#define tok_malloc(a) malloc(a)
+#define tok_free(a) free(a)
+#define tok_realloc(a, b) realloc(a, b)
+
+
+struct tokenizer {
+ char *ifs; /* In field separator */
+ int argc, amax; /* Current and maximum number of args */
+ char **argv; /* Argument list */
+ char *wptr, *wmax; /* Space and limit on the word buffer */
+ char *wstart; /* Beginning of next word */
+ char *wspace; /* Space of word buffer */
+ quote_t quote; /* Quoting state */
+ int flags; /* flags; */
+};
+
+
+private void tok_finish(Tokenizer *);
+
+
+/* tok_finish():
+ * Finish a word in the tokenizer.
+ */
+private void
+tok_finish(Tokenizer *tok)
+{
+
+ *tok->wptr = '\0';
+ if ((tok->flags & TOK_KEEP) || tok->wptr != tok->wstart) {
+ tok->argv[tok->argc++] = tok->wstart;
+ tok->argv[tok->argc] = NULL;
+ tok->wstart = ++tok->wptr;
+ }
+ tok->flags &= ~TOK_KEEP;
+}
+
+
+/* tok_init():
+ * Initialize the tokenizer
+ */
+public Tokenizer *
+tok_init(const char *ifs)
+{
+ Tokenizer *tok = (Tokenizer *) tok_malloc(sizeof(Tokenizer));
+
+ if (tok == NULL)
+ return NULL;
+ tok->ifs = tok_strdup(ifs ? ifs : IFS);
+ if (tok->ifs == NULL) {
+ tok_free((ptr_t)tok);
+ return NULL;
+ }
+ tok->argc = 0;
+ tok->amax = AINCR;
+ tok->argv = (char **) tok_malloc(sizeof(char *) * tok->amax);
+ if (tok->argv == NULL) {
+ tok_free((ptr_t)tok->ifs);
+ tok_free((ptr_t)tok);
+ return NULL;
+ }
+ tok->argv[0] = NULL;
+ tok->wspace = (char *) tok_malloc(WINCR);
+ if (tok->wspace == NULL) {
+ tok_free((ptr_t)tok->argv);
+ tok_free((ptr_t)tok->ifs);
+ tok_free((ptr_t)tok);
+ return NULL;
+ }
+ tok->wmax = tok->wspace + WINCR;
+ tok->wstart = tok->wspace;
+ tok->wptr = tok->wspace;
+ tok->flags = 0;
+ tok->quote = Q_none;
+
+ return (tok);
+}
+
+
+/* tok_reset():
+ * Reset the tokenizer
+ */
+public void
+tok_reset(Tokenizer *tok)
+{
+
+ tok->argc = 0;
+ tok->wstart = tok->wspace;
+ tok->wptr = tok->wspace;
+ tok->flags = 0;
+ tok->quote = Q_none;
+}
+
+
+/* tok_end():
+ * Clean up
+ */
+public void
+tok_end(Tokenizer *tok)
+{
+
+ tok_free((ptr_t) tok->ifs);
+ tok_free((ptr_t) tok->wspace);
+ tok_free((ptr_t) tok->argv);
+ tok_free((ptr_t) tok);
+}
+
+
+
+/* tok_line():
+ * Bourne shell (sh(1)) like tokenizing
+ * Arguments:
+ * tok current tokenizer state (setup with tok_init())
+ * line line to parse
+ * Returns:
+ * -1 Internal error
+ * 3 Quoted return
+ * 2 Unmatched double quote
+ * 1 Unmatched single quote
+ * 0 Ok
+ * Modifies (if return value is 0):
+ * argc number of arguments
+ * argv argument array
+ * cursorc if !NULL, argv element containing cursor
+ * cursorv if !NULL, offset in argv[cursorc] of cursor
+ */
+public int
+tok_line(Tokenizer *tok, const LineInfo *line,
+ int *argc, const char ***argv, int *cursorc, int *cursoro)
+{
+ const char *ptr;
+ int cc, co;
+
+ cc = co = -1;
+ ptr = line->buffer;
+ for (ptr = line->buffer; ;ptr++) {
+ if (ptr >= line->lastchar)
+ ptr = "";
+ if (ptr == line->cursor) {
+ cc = tok->argc;
+ co = tok->wptr - tok->wstart;
+ }
+ switch (*ptr) {
+ case '\'':
+ tok->flags |= TOK_KEEP;
+ tok->flags &= ~TOK_EAT;
+ switch (tok->quote) {
+ case Q_none:
+ tok->quote = Q_single; /* Enter single quote
+ * mode */
+ break;
+
+ case Q_single: /* Exit single quote mode */
+ tok->quote = Q_none;
+ break;
+
+ case Q_one: /* Quote this ' */
+ tok->quote = Q_none;
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_double: /* Stay in double quote mode */
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_doubleone: /* Quote this ' */
+ tok->quote = Q_double;
+ *tok->wptr++ = *ptr;
+ break;
+
+ default:
+ return (-1);
+ }
+ break;
+
+ case '"':
+ tok->flags &= ~TOK_EAT;
+ tok->flags |= TOK_KEEP;
+ switch (tok->quote) {
+ case Q_none: /* Enter double quote mode */
+ tok->quote = Q_double;
+ break;
+
+ case Q_double: /* Exit double quote mode */
+ tok->quote = Q_none;
+ break;
+
+ case Q_one: /* Quote this " */
+ tok->quote = Q_none;
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_single: /* Stay in single quote mode */
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_doubleone: /* Quote this " */
+ tok->quote = Q_double;
+ *tok->wptr++ = *ptr;
+ break;
+
+ default:
+ return (-1);
+ }
+ break;
+
+ case '\\':
+ tok->flags |= TOK_KEEP;
+ tok->flags &= ~TOK_EAT;
+ switch (tok->quote) {
+ case Q_none: /* Quote next character */
+ tok->quote = Q_one;
+ break;
+
+ case Q_double: /* Quote next character */
+ tok->quote = Q_doubleone;
+ break;
+
+ case Q_one: /* Quote this, restore state */
+ *tok->wptr++ = *ptr;
+ tok->quote = Q_none;
+ break;
+
+ case Q_single: /* Stay in single quote mode */
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_doubleone: /* Quote this \ */
+ tok->quote = Q_double;
+ *tok->wptr++ = *ptr;
+ break;
+
+ default:
+ return (-1);
+ }
+ break;
+
+ case '\n':
+ tok->flags &= ~TOK_EAT;
+ switch (tok->quote) {
+ case Q_none:
+ goto tok_line_outok;
+
+ case Q_single:
+ case Q_double:
+ *tok->wptr++ = *ptr; /* Add the return */
+ break;
+
+ case Q_doubleone: /* Back to double, eat the '\n' */
+ tok->flags |= TOK_EAT;
+ tok->quote = Q_double;
+ break;
+
+ case Q_one: /* No quote, more eat the '\n' */
+ tok->flags |= TOK_EAT;
+ tok->quote = Q_none;
+ break;
+
+ default:
+ return (0);
+ }
+ break;
+
+ case '\0':
+ switch (tok->quote) {
+ case Q_none:
+ /* Finish word and return */
+ if (tok->flags & TOK_EAT) {
+ tok->flags &= ~TOK_EAT;
+ return (3);
+ }
+ goto tok_line_outok;
+
+ case Q_single:
+ return (1);
+
+ case Q_double:
+ return (2);
+
+ case Q_doubleone:
+ tok->quote = Q_double;
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_one:
+ tok->quote = Q_none;
+ *tok->wptr++ = *ptr;
+ break;
+
+ default:
+ return (-1);
+ }
+ break;
+
+ default:
+ tok->flags &= ~TOK_EAT;
+ switch (tok->quote) {
+ case Q_none:
+ if (strchr(tok->ifs, *ptr) != NULL)
+ tok_finish(tok);
+ else
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_single:
+ case Q_double:
+ *tok->wptr++ = *ptr;
+ break;
+
+
+ case Q_doubleone:
+ *tok->wptr++ = '\\';
+ tok->quote = Q_double;
+ *tok->wptr++ = *ptr;
+ break;
+
+ case Q_one:
+ tok->quote = Q_none;
+ *tok->wptr++ = *ptr;
+ break;
+
+ default:
+ return (-1);
+
+ }
+ break;
+ }
+
+ if (tok->wptr >= tok->wmax - 4) {
+ size_t size = tok->wmax - tok->wspace + WINCR;
+ char *s = (char *) tok_realloc(tok->wspace, size);
+ if (s == NULL)
+ return (-1);
+
+ if (s != tok->wspace) {
+ int i;
+ for (i = 0; i < tok->argc; i++) {
+ tok->argv[i] =
+ (tok->argv[i] - tok->wspace) + s;
+ }
+ tok->wptr = (tok->wptr - tok->wspace) + s;
+ tok->wstart = (tok->wstart - tok->wspace) + s;
+ tok->wspace = s;
+ }
+ tok->wmax = s + size;
+ }
+ if (tok->argc >= tok->amax - 4) {
+ char **p;
+ tok->amax += AINCR;
+ p = (char **) tok_realloc(tok->argv,
+ tok->amax * sizeof(char *));
+ if (p == NULL)
+ return (-1);
+ tok->argv = p;
+ }
+ }
+ tok_line_outok:
+ if (cc == -1 && co == -1) {
+ cc = tok->argc;
+ co = tok->wptr - tok->wstart;
+ }
+ if (cursorc != NULL)
+ *cursorc = cc;
+ if (cursoro != NULL)
+ *cursoro = co;
+ tok_finish(tok);
+ *argv = (const char **)tok->argv;
+ *argc = tok->argc;
+ return (0);
+}
+
+/* tok_str():
+ * Simpler version of tok_line, taking a NUL terminated line
+ * and splitting into words, ignoring cursor state.
+ */
+public int
+tok_str(Tokenizer *tok, const char *line, int *argc, const char ***argv)
+{
+ LineInfo li;
+
+ memset(&li, 0, sizeof(li));
+ li.buffer = line;
+ li.cursor = li.lastchar = strchr(line, '\0');
+ return (tok_line(tok, &li, argc, argv, NULL, NULL));
+}
diff --git a/frontend/libedit/tty.c b/frontend/libedit/tty.c
new file mode 100644
index 0000000..8120da0
--- /dev/null
+++ b/frontend/libedit/tty.c
@@ -0,0 +1,1306 @@
+/* $NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+
+/*
+ * tty.c: tty interface stuff
+ */
+#include <assert.h>
+#include "tty.h"
+#include "el.h"
+
+typedef struct ttymodes_t {
+ const char *m_name;
+ unsigned int m_value;
+ int m_type;
+} ttymodes_t;
+
+typedef struct ttymap_t {
+ int nch, och; /* Internal and termio rep of chars */
+ el_action_t bind[3]; /* emacs, vi, and vi-cmd */
+} ttymap_t;
+
+
+private const ttyperm_t ttyperm = {
+ {
+ {"iflag:", ICRNL, (INLCR | IGNCR)},
+ {"oflag:", (OPOST | ONLCR), ONLRET},
+ {"cflag:", 0, 0},
+ {"lflag:", (ISIG | ICANON | ECHO | ECHOE | ECHOCTL | IEXTEN),
+ (NOFLSH | ECHONL | EXTPROC | FLUSHO)},
+ {"chars:", 0, 0},
+ },
+ {
+ {"iflag:", (INLCR | ICRNL), IGNCR},
+ {"oflag:", (OPOST | ONLCR), ONLRET},
+ {"cflag:", 0, 0},
+ {"lflag:", ISIG,
+ (NOFLSH | ICANON | ECHO | ECHOK | ECHONL | EXTPROC | IEXTEN | FLUSHO)},
+ {"chars:", (C_SH(C_MIN) | C_SH(C_TIME) | C_SH(C_SWTCH) | C_SH(C_DSWTCH) |
+ C_SH(C_SUSP) | C_SH(C_DSUSP) | C_SH(C_EOL) | C_SH(C_DISCARD) |
+ C_SH(C_PGOFF) | C_SH(C_PAGE) | C_SH(C_STATUS)), 0}
+ },
+ {
+ {"iflag:", 0, IXON | IXOFF | INLCR | ICRNL},
+ {"oflag:", 0, 0},
+ {"cflag:", 0, 0},
+ {"lflag:", 0, ISIG | IEXTEN},
+ {"chars:", 0, 0},
+ }
+};
+
+private const ttychar_t ttychar = {
+ {
+ CINTR, CQUIT, CERASE, CKILL,
+ CEOF, CEOL, CEOL2, CSWTCH,
+ CDSWTCH, CERASE2, CSTART, CSTOP,
+ CWERASE, CSUSP, CDSUSP, CREPRINT,
+ CDISCARD, CLNEXT, CSTATUS, CPAGE,
+ CPGOFF, CKILL2, CBRK, CMIN,
+ CTIME
+ },
+ {
+ CINTR, CQUIT, CERASE, CKILL,
+ _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
+ _POSIX_VDISABLE, CERASE2, CSTART, CSTOP,
+ _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE,
+ CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
+ _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1,
+ 0
+ },
+ {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0
+ }
+};
+
+private const ttymap_t tty_map[] = {
+#ifdef VERASE
+ {C_ERASE, VERASE,
+ {ED_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}},
+#endif /* VERASE */
+#ifdef VERASE2
+ {C_ERASE2, VERASE2,
+ {ED_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}},
+#endif /* VERASE2 */
+#ifdef VKILL
+ {C_KILL, VKILL,
+ {EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED}},
+#endif /* VKILL */
+#ifdef VKILL2
+ {C_KILL2, VKILL2,
+ {EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED}},
+#endif /* VKILL2 */
+#ifdef VEOF
+ {C_EOF, VEOF,
+ {EM_DELETE_OR_LIST, VI_LIST_OR_EOF, ED_UNASSIGNED}},
+#endif /* VEOF */
+#ifdef VWERASE
+ {C_WERASE, VWERASE,
+ {ED_DELETE_PREV_WORD, ED_DELETE_PREV_WORD, ED_PREV_WORD}},
+#endif /* VWERASE */
+#ifdef VREPRINT
+ {C_REPRINT, VREPRINT,
+ {ED_REDISPLAY, ED_INSERT, ED_REDISPLAY}},
+#endif /* VREPRINT */
+#ifdef VLNEXT
+ {C_LNEXT, VLNEXT,
+ {ED_QUOTED_INSERT, ED_QUOTED_INSERT, ED_UNASSIGNED}},
+#endif /* VLNEXT */
+ {-1, -1,
+ {ED_UNASSIGNED, ED_UNASSIGNED, ED_UNASSIGNED}}
+};
+
+private const ttymodes_t ttymodes[] = {
+#ifdef IGNBRK
+ {"ignbrk", IGNBRK, MD_INP},
+#endif /* IGNBRK */
+#ifdef BRKINT
+ {"brkint", BRKINT, MD_INP},
+#endif /* BRKINT */
+#ifdef IGNPAR
+ {"ignpar", IGNPAR, MD_INP},
+#endif /* IGNPAR */
+#ifdef PARMRK
+ {"parmrk", PARMRK, MD_INP},
+#endif /* PARMRK */
+#ifdef INPCK
+ {"inpck", INPCK, MD_INP},
+#endif /* INPCK */
+#ifdef ISTRIP
+ {"istrip", ISTRIP, MD_INP},
+#endif /* ISTRIP */
+#ifdef INLCR
+ {"inlcr", INLCR, MD_INP},
+#endif /* INLCR */
+#ifdef IGNCR
+ {"igncr", IGNCR, MD_INP},
+#endif /* IGNCR */
+#ifdef ICRNL
+ {"icrnl", ICRNL, MD_INP},
+#endif /* ICRNL */
+#ifdef IUCLC
+ {"iuclc", IUCLC, MD_INP},
+#endif /* IUCLC */
+#ifdef IXON
+ {"ixon", IXON, MD_INP},
+#endif /* IXON */
+#ifdef IXANY
+ {"ixany", IXANY, MD_INP},
+#endif /* IXANY */
+#ifdef IXOFF
+ {"ixoff", IXOFF, MD_INP},
+#endif /* IXOFF */
+#ifdef IMAXBEL
+ {"imaxbel", IMAXBEL, MD_INP},
+#endif /* IMAXBEL */
+
+#ifdef OPOST
+ {"opost", OPOST, MD_OUT},
+#endif /* OPOST */
+#ifdef OLCUC
+ {"olcuc", OLCUC, MD_OUT},
+#endif /* OLCUC */
+#ifdef ONLCR
+ {"onlcr", ONLCR, MD_OUT},
+#endif /* ONLCR */
+#ifdef OCRNL
+ {"ocrnl", OCRNL, MD_OUT},
+#endif /* OCRNL */
+#ifdef ONOCR
+ {"onocr", ONOCR, MD_OUT},
+#endif /* ONOCR */
+#ifdef ONOEOT
+ {"onoeot", ONOEOT, MD_OUT},
+#endif /* ONOEOT */
+#ifdef ONLRET
+ {"onlret", ONLRET, MD_OUT},
+#endif /* ONLRET */
+#ifdef OFILL
+ {"ofill", OFILL, MD_OUT},
+#endif /* OFILL */
+#ifdef OFDEL
+ {"ofdel", OFDEL, MD_OUT},
+#endif /* OFDEL */
+#ifdef NLDLY
+ {"nldly", NLDLY, MD_OUT},
+#endif /* NLDLY */
+#ifdef CRDLY
+ {"crdly", CRDLY, MD_OUT},
+#endif /* CRDLY */
+#ifdef TABDLY
+ {"tabdly", TABDLY, MD_OUT},
+#endif /* TABDLY */
+#ifdef XTABS
+ {"xtabs", XTABS, MD_OUT},
+#endif /* XTABS */
+#ifdef BSDLY
+ {"bsdly", BSDLY, MD_OUT},
+#endif /* BSDLY */
+#ifdef VTDLY
+ {"vtdly", VTDLY, MD_OUT},
+#endif /* VTDLY */
+#ifdef FFDLY
+ {"ffdly", FFDLY, MD_OUT},
+#endif /* FFDLY */
+#ifdef PAGEOUT
+ {"pageout", PAGEOUT, MD_OUT},
+#endif /* PAGEOUT */
+#ifdef WRAP
+ {"wrap", WRAP, MD_OUT},
+#endif /* WRAP */
+
+#ifdef CIGNORE
+ {"cignore", CIGNORE, MD_CTL},
+#endif /* CBAUD */
+#ifdef CBAUD
+ {"cbaud", CBAUD, MD_CTL},
+#endif /* CBAUD */
+#ifdef CSTOPB
+ {"cstopb", CSTOPB, MD_CTL},
+#endif /* CSTOPB */
+#ifdef CREAD
+ {"cread", CREAD, MD_CTL},
+#endif /* CREAD */
+#ifdef PARENB
+ {"parenb", PARENB, MD_CTL},
+#endif /* PARENB */
+#ifdef PARODD
+ {"parodd", PARODD, MD_CTL},
+#endif /* PARODD */
+#ifdef HUPCL
+ {"hupcl", HUPCL, MD_CTL},
+#endif /* HUPCL */
+#ifdef CLOCAL
+ {"clocal", CLOCAL, MD_CTL},
+#endif /* CLOCAL */
+#ifdef LOBLK
+ {"loblk", LOBLK, MD_CTL},
+#endif /* LOBLK */
+#ifdef CIBAUD
+ {"cibaud", CIBAUD, MD_CTL},
+#endif /* CIBAUD */
+#ifdef CRTSCTS
+#ifdef CCTS_OFLOW
+ {"ccts_oflow", CCTS_OFLOW, MD_CTL},
+#else
+ {"crtscts", CRTSCTS, MD_CTL},
+#endif /* CCTS_OFLOW */
+#endif /* CRTSCTS */
+#ifdef CRTS_IFLOW
+ {"crts_iflow", CRTS_IFLOW, MD_CTL},
+#endif /* CRTS_IFLOW */
+#ifdef CDTRCTS
+ {"cdtrcts", CDTRCTS, MD_CTL},
+#endif /* CDTRCTS */
+#ifdef MDMBUF
+ {"mdmbuf", MDMBUF, MD_CTL},
+#endif /* MDMBUF */
+#ifdef RCV1EN
+ {"rcv1en", RCV1EN, MD_CTL},
+#endif /* RCV1EN */
+#ifdef XMT1EN
+ {"xmt1en", XMT1EN, MD_CTL},
+#endif /* XMT1EN */
+
+#ifdef ISIG
+ {"isig", ISIG, MD_LIN},
+#endif /* ISIG */
+#ifdef ICANON
+ {"icanon", ICANON, MD_LIN},
+#endif /* ICANON */
+#ifdef XCASE
+ {"xcase", XCASE, MD_LIN},
+#endif /* XCASE */
+#ifdef ECHO
+ {"echo", ECHO, MD_LIN},
+#endif /* ECHO */
+#ifdef ECHOE
+ {"echoe", ECHOE, MD_LIN},
+#endif /* ECHOE */
+#ifdef ECHOK
+ {"echok", ECHOK, MD_LIN},
+#endif /* ECHOK */
+#ifdef ECHONL
+ {"echonl", ECHONL, MD_LIN},
+#endif /* ECHONL */
+#ifdef NOFLSH
+ {"noflsh", NOFLSH, MD_LIN},
+#endif /* NOFLSH */
+#ifdef TOSTOP
+ {"tostop", TOSTOP, MD_LIN},
+#endif /* TOSTOP */
+#ifdef ECHOCTL
+ {"echoctl", ECHOCTL, MD_LIN},
+#endif /* ECHOCTL */
+#ifdef ECHOPRT
+ {"echoprt", ECHOPRT, MD_LIN},
+#endif /* ECHOPRT */
+#ifdef ECHOKE
+ {"echoke", ECHOKE, MD_LIN},
+#endif /* ECHOKE */
+#ifdef DEFECHO
+ {"defecho", DEFECHO, MD_LIN},
+#endif /* DEFECHO */
+#ifdef FLUSHO
+ {"flusho", FLUSHO, MD_LIN},
+#endif /* FLUSHO */
+#ifdef PENDIN
+ {"pendin", PENDIN, MD_LIN},
+#endif /* PENDIN */
+#ifdef IEXTEN
+ {"iexten", IEXTEN, MD_LIN},
+#endif /* IEXTEN */
+#ifdef NOKERNINFO
+ {"nokerninfo", NOKERNINFO, MD_LIN},
+#endif /* NOKERNINFO */
+#ifdef ALTWERASE
+ {"altwerase", ALTWERASE, MD_LIN},
+#endif /* ALTWERASE */
+#ifdef EXTPROC
+ {"extproc", EXTPROC, MD_LIN},
+#endif /* EXTPROC */
+
+#if defined(VINTR)
+ {"intr", C_SH(C_INTR), MD_CHAR},
+#endif /* VINTR */
+#if defined(VQUIT)
+ {"quit", C_SH(C_QUIT), MD_CHAR},
+#endif /* VQUIT */
+#if defined(VERASE)
+ {"erase", C_SH(C_ERASE), MD_CHAR},
+#endif /* VERASE */
+#if defined(VKILL)
+ {"kill", C_SH(C_KILL), MD_CHAR},
+#endif /* VKILL */
+#if defined(VEOF)
+ {"eof", C_SH(C_EOF), MD_CHAR},
+#endif /* VEOF */
+#if defined(VEOL)
+ {"eol", C_SH(C_EOL), MD_CHAR},
+#endif /* VEOL */
+#if defined(VEOL2)
+ {"eol2", C_SH(C_EOL2), MD_CHAR},
+#endif /* VEOL2 */
+#if defined(VSWTCH)
+ {"swtch", C_SH(C_SWTCH), MD_CHAR},
+#endif /* VSWTCH */
+#if defined(VDSWTCH)
+ {"dswtch", C_SH(C_DSWTCH), MD_CHAR},
+#endif /* VDSWTCH */
+#if defined(VERASE2)
+ {"erase2", C_SH(C_ERASE2), MD_CHAR},
+#endif /* VERASE2 */
+#if defined(VSTART)
+ {"start", C_SH(C_START), MD_CHAR},
+#endif /* VSTART */
+#if defined(VSTOP)
+ {"stop", C_SH(C_STOP), MD_CHAR},
+#endif /* VSTOP */
+#if defined(VWERASE)
+ {"werase", C_SH(C_WERASE), MD_CHAR},
+#endif /* VWERASE */
+#if defined(VSUSP)
+ {"susp", C_SH(C_SUSP), MD_CHAR},
+#endif /* VSUSP */
+#if defined(VDSUSP)
+ {"dsusp", C_SH(C_DSUSP), MD_CHAR},
+#endif /* VDSUSP */
+#if defined(VREPRINT)
+ {"reprint", C_SH(C_REPRINT), MD_CHAR},
+#endif /* VREPRINT */
+#if defined(VDISCARD)
+ {"discard", C_SH(C_DISCARD), MD_CHAR},
+#endif /* VDISCARD */
+#if defined(VLNEXT)
+ {"lnext", C_SH(C_LNEXT), MD_CHAR},
+#endif /* VLNEXT */
+#if defined(VSTATUS)
+ {"status", C_SH(C_STATUS), MD_CHAR},
+#endif /* VSTATUS */
+#if defined(VPAGE)
+ {"page", C_SH(C_PAGE), MD_CHAR},
+#endif /* VPAGE */
+#if defined(VPGOFF)
+ {"pgoff", C_SH(C_PGOFF), MD_CHAR},
+#endif /* VPGOFF */
+#if defined(VKILL2)
+ {"kill2", C_SH(C_KILL2), MD_CHAR},
+#endif /* VKILL2 */
+#if defined(VBRK)
+ {"brk", C_SH(C_BRK), MD_CHAR},
+#endif /* VBRK */
+#if defined(VMIN)
+ {"min", C_SH(C_MIN), MD_CHAR},
+#endif /* VMIN */
+#if defined(VTIME)
+ {"time", C_SH(C_TIME), MD_CHAR},
+#endif /* VTIME */
+ {NULL, 0, -1},
+};
+
+
+
+#define tty_getty(el, td) tcgetattr((el)->el_infd, (td))
+#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td))
+
+#define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1)
+#define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8)
+#define tty__cooked_mode(td) ((td)->c_lflag & ICANON)
+
+private int tty__getcharindex(int);
+private void tty__getchar(struct termios *, unsigned char *);
+private void tty__setchar(struct termios *, unsigned char *);
+private speed_t tty__getspeed(struct termios *);
+private int tty_setup(EditLine *);
+
+#define t_qu t_ts
+
+
+/* tty_setup():
+ * Get the tty parameters and initialize the editing state
+ */
+private int
+tty_setup(EditLine *el)
+{
+ int rst = 1;
+
+ if (el->el_flags & EDIT_DISABLED)
+ return (0);
+
+ if (tty_getty(el, &el->el_tty.t_ed) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile,
+ "tty_setup: tty_getty: %s\n", strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ el->el_tty.t_ts = el->el_tty.t_ex = el->el_tty.t_ed;
+
+ el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ex);
+ el->el_tty.t_tabs = tty__gettabs(&el->el_tty.t_ex);
+ el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ex);
+
+ el->el_tty.t_ex.c_iflag &= ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask;
+ el->el_tty.t_ex.c_iflag |= el->el_tty.t_t[EX_IO][MD_INP].t_setmask;
+
+ el->el_tty.t_ex.c_oflag &= ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask;
+ el->el_tty.t_ex.c_oflag |= el->el_tty.t_t[EX_IO][MD_OUT].t_setmask;
+
+ el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask;
+ el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][MD_CTL].t_setmask;
+
+ el->el_tty.t_ex.c_lflag &= ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask;
+ el->el_tty.t_ex.c_lflag |= el->el_tty.t_t[EX_IO][MD_LIN].t_setmask;
+
+ /*
+ * Reset the tty chars to reasonable defaults
+ * If they are disabled, then enable them.
+ */
+ if (rst) {
+ if (tty__cooked_mode(&el->el_tty.t_ts)) {
+ tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]);
+ /*
+ * Don't affect CMIN and CTIME for the editor mode
+ */
+ for (rst = 0; rst < C_NCC - 2; rst++)
+ if (el->el_tty.t_c[TS_IO][rst] !=
+ el->el_tty.t_vdisable
+ && el->el_tty.t_c[ED_IO][rst] !=
+ el->el_tty.t_vdisable)
+ el->el_tty.t_c[ED_IO][rst] =
+ el->el_tty.t_c[TS_IO][rst];
+ for (rst = 0; rst < C_NCC; rst++)
+ if (el->el_tty.t_c[TS_IO][rst] !=
+ el->el_tty.t_vdisable)
+ el->el_tty.t_c[EX_IO][rst] =
+ el->el_tty.t_c[TS_IO][rst];
+ }
+ tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);
+ if (tty_setty(el, &el->el_tty.t_ex) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile,
+ "tty_setup: tty_setty: %s\n",
+ strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ }
+#ifdef notdef
+ else
+ tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);
+#endif
+
+ el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask;
+ el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask;
+
+ el->el_tty.t_ed.c_oflag &= ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask;
+ el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][MD_OUT].t_setmask;
+
+ el->el_tty.t_ed.c_cflag &= ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask;
+ el->el_tty.t_ed.c_cflag |= el->el_tty.t_t[ED_IO][MD_CTL].t_setmask;
+
+ el->el_tty.t_ed.c_lflag &= ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask;
+ el->el_tty.t_ed.c_lflag |= el->el_tty.t_t[ED_IO][MD_LIN].t_setmask;
+
+ tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]);
+ tty_bind_char(el, 1);
+ return (0);
+}
+
+protected int
+tty_init(EditLine *el)
+{
+
+ el->el_tty.t_mode = EX_IO;
+ el->el_tty.t_vdisable = _POSIX_VDISABLE;
+ (void) memcpy(el->el_tty.t_t, ttyperm, sizeof(ttyperm_t));
+ (void) memcpy(el->el_tty.t_c, ttychar, sizeof(ttychar_t));
+ return (tty_setup(el));
+}
+
+
+/* tty_end():
+ * Restore the tty to its original settings
+ */
+protected void
+/*ARGSUSED*/
+tty_end(EditLine *el __attribute__((__unused__)))
+{
+
+ /* XXX: Maybe reset to an initial state? */
+}
+
+
+/* tty__getspeed():
+ * Get the tty speed
+ */
+private speed_t
+tty__getspeed(struct termios *td)
+{
+ speed_t spd;
+
+ if ((spd = cfgetispeed(td)) == 0)
+ spd = cfgetospeed(td);
+ return (spd);
+}
+
+/* tty__getspeed():
+ * Return the index of the asked char in the c_cc array
+ */
+private int
+tty__getcharindex(int i)
+{
+ switch (i) {
+#ifdef VINTR
+ case C_INTR:
+ return VINTR;
+#endif /* VINTR */
+#ifdef VQUIT
+ case C_QUIT:
+ return VQUIT;
+#endif /* VQUIT */
+#ifdef VERASE
+ case C_ERASE:
+ return VERASE;
+#endif /* VERASE */
+#ifdef VKILL
+ case C_KILL:
+ return VKILL;
+#endif /* VKILL */
+#ifdef VEOF
+ case C_EOF:
+ return VEOF;
+#endif /* VEOF */
+#ifdef VEOL
+ case C_EOL:
+ return VEOL;
+#endif /* VEOL */
+#ifdef VEOL2
+ case C_EOL2:
+ return VEOL2;
+#endif /* VEOL2 */
+#ifdef VSWTCH
+ case C_SWTCH:
+ return VSWTCH;
+#endif /* VSWTCH */
+#ifdef VDSWTCH
+ case C_DSWTCH:
+ return VDSWTCH;
+#endif /* VDSWTCH */
+#ifdef VERASE2
+ case C_ERASE2:
+ return VERASE2;
+#endif /* VERASE2 */
+#ifdef VSTART
+ case C_START:
+ return VSTART;
+#endif /* VSTART */
+#ifdef VSTOP
+ case C_STOP:
+ return VSTOP;
+#endif /* VSTOP */
+#ifdef VWERASE
+ case C_WERASE:
+ return VWERASE;
+#endif /* VWERASE */
+#ifdef VSUSP
+ case C_SUSP:
+ return VSUSP;
+#endif /* VSUSP */
+#ifdef VDSUSP
+ case C_DSUSP:
+ return VDSUSP;
+#endif /* VDSUSP */
+#ifdef VREPRINT
+ case C_REPRINT:
+ return VREPRINT;
+#endif /* VREPRINT */
+#ifdef VDISCARD
+ case C_DISCARD:
+ return VDISCARD;
+#endif /* VDISCARD */
+#ifdef VLNEXT
+ case C_LNEXT:
+ return VLNEXT;
+#endif /* VLNEXT */
+#ifdef VSTATUS
+ case C_STATUS:
+ return VSTATUS;
+#endif /* VSTATUS */
+#ifdef VPAGE
+ case C_PAGE:
+ return VPAGE;
+#endif /* VPAGE */
+#ifdef VPGOFF
+ case C_PGOFF:
+ return VPGOFF;
+#endif /* VPGOFF */
+#ifdef VKILL2
+ case C_KILL2:
+ return VKILL2;
+#endif /* KILL2 */
+#ifdef VMIN
+ case C_MIN:
+ return VMIN;
+#endif /* VMIN */
+#ifdef VTIME
+ case C_TIME:
+ return VTIME;
+#endif /* VTIME */
+ default:
+ return -1;
+ }
+}
+
+/* tty__getchar():
+ * Get the tty characters
+ */
+private void
+tty__getchar(struct termios *td, unsigned char *s)
+{
+
+#ifdef VINTR
+ s[C_INTR] = td->c_cc[VINTR];
+#endif /* VINTR */
+#ifdef VQUIT
+ s[C_QUIT] = td->c_cc[VQUIT];
+#endif /* VQUIT */
+#ifdef VERASE
+ s[C_ERASE] = td->c_cc[VERASE];
+#endif /* VERASE */
+#ifdef VKILL
+ s[C_KILL] = td->c_cc[VKILL];
+#endif /* VKILL */
+#ifdef VEOF
+ s[C_EOF] = td->c_cc[VEOF];
+#endif /* VEOF */
+#ifdef VEOL
+ s[C_EOL] = td->c_cc[VEOL];
+#endif /* VEOL */
+#ifdef VEOL2
+ s[C_EOL2] = td->c_cc[VEOL2];
+#endif /* VEOL2 */
+#ifdef VSWTCH
+ s[C_SWTCH] = td->c_cc[VSWTCH];
+#endif /* VSWTCH */
+#ifdef VDSWTCH
+ s[C_DSWTCH] = td->c_cc[VDSWTCH];
+#endif /* VDSWTCH */
+#ifdef VERASE2
+ s[C_ERASE2] = td->c_cc[VERASE2];
+#endif /* VERASE2 */
+#ifdef VSTART
+ s[C_START] = td->c_cc[VSTART];
+#endif /* VSTART */
+#ifdef VSTOP
+ s[C_STOP] = td->c_cc[VSTOP];
+#endif /* VSTOP */
+#ifdef VWERASE
+ s[C_WERASE] = td->c_cc[VWERASE];
+#endif /* VWERASE */
+#ifdef VSUSP
+ s[C_SUSP] = td->c_cc[VSUSP];
+#endif /* VSUSP */
+#ifdef VDSUSP
+ s[C_DSUSP] = td->c_cc[VDSUSP];
+#endif /* VDSUSP */
+#ifdef VREPRINT
+ s[C_REPRINT] = td->c_cc[VREPRINT];
+#endif /* VREPRINT */
+#ifdef VDISCARD
+ s[C_DISCARD] = td->c_cc[VDISCARD];
+#endif /* VDISCARD */
+#ifdef VLNEXT
+ s[C_LNEXT] = td->c_cc[VLNEXT];
+#endif /* VLNEXT */
+#ifdef VSTATUS
+ s[C_STATUS] = td->c_cc[VSTATUS];
+#endif /* VSTATUS */
+#ifdef VPAGE
+ s[C_PAGE] = td->c_cc[VPAGE];
+#endif /* VPAGE */
+#ifdef VPGOFF
+ s[C_PGOFF] = td->c_cc[VPGOFF];
+#endif /* VPGOFF */
+#ifdef VKILL2
+ s[C_KILL2] = td->c_cc[VKILL2];
+#endif /* KILL2 */
+#ifdef VMIN
+ s[C_MIN] = td->c_cc[VMIN];
+#endif /* VMIN */
+#ifdef VTIME
+ s[C_TIME] = td->c_cc[VTIME];
+#endif /* VTIME */
+} /* tty__getchar */
+
+
+/* tty__setchar():
+ * Set the tty characters
+ */
+private void
+tty__setchar(struct termios *td, unsigned char *s)
+{
+
+#ifdef VINTR
+ td->c_cc[VINTR] = s[C_INTR];
+#endif /* VINTR */
+#ifdef VQUIT
+ td->c_cc[VQUIT] = s[C_QUIT];
+#endif /* VQUIT */
+#ifdef VERASE
+ td->c_cc[VERASE] = s[C_ERASE];
+#endif /* VERASE */
+#ifdef VKILL
+ td->c_cc[VKILL] = s[C_KILL];
+#endif /* VKILL */
+#ifdef VEOF
+ td->c_cc[VEOF] = s[C_EOF];
+#endif /* VEOF */
+#ifdef VEOL
+ td->c_cc[VEOL] = s[C_EOL];
+#endif /* VEOL */
+#ifdef VEOL2
+ td->c_cc[VEOL2] = s[C_EOL2];
+#endif /* VEOL2 */
+#ifdef VSWTCH
+ td->c_cc[VSWTCH] = s[C_SWTCH];
+#endif /* VSWTCH */
+#ifdef VDSWTCH
+ td->c_cc[VDSWTCH] = s[C_DSWTCH];
+#endif /* VDSWTCH */
+#ifdef VERASE2
+ td->c_cc[VERASE2] = s[C_ERASE2];
+#endif /* VERASE2 */
+#ifdef VSTART
+ td->c_cc[VSTART] = s[C_START];
+#endif /* VSTART */
+#ifdef VSTOP
+ td->c_cc[VSTOP] = s[C_STOP];
+#endif /* VSTOP */
+#ifdef VWERASE
+ td->c_cc[VWERASE] = s[C_WERASE];
+#endif /* VWERASE */
+#ifdef VSUSP
+ td->c_cc[VSUSP] = s[C_SUSP];
+#endif /* VSUSP */
+#ifdef VDSUSP
+ td->c_cc[VDSUSP] = s[C_DSUSP];
+#endif /* VDSUSP */
+#ifdef VREPRINT
+ td->c_cc[VREPRINT] = s[C_REPRINT];
+#endif /* VREPRINT */
+#ifdef VDISCARD
+ td->c_cc[VDISCARD] = s[C_DISCARD];
+#endif /* VDISCARD */
+#ifdef VLNEXT
+ td->c_cc[VLNEXT] = s[C_LNEXT];
+#endif /* VLNEXT */
+#ifdef VSTATUS
+ td->c_cc[VSTATUS] = s[C_STATUS];
+#endif /* VSTATUS */
+#ifdef VPAGE
+ td->c_cc[VPAGE] = s[C_PAGE];
+#endif /* VPAGE */
+#ifdef VPGOFF
+ td->c_cc[VPGOFF] = s[C_PGOFF];
+#endif /* VPGOFF */
+#ifdef VKILL2
+ td->c_cc[VKILL2] = s[C_KILL2];
+#endif /* VKILL2 */
+#ifdef VMIN
+ td->c_cc[VMIN] = s[C_MIN];
+#endif /* VMIN */
+#ifdef VTIME
+ td->c_cc[VTIME] = s[C_TIME];
+#endif /* VTIME */
+} /* tty__setchar */
+
+
+/* tty_bind_char():
+ * Rebind the editline functions
+ */
+protected void
+tty_bind_char(EditLine *el, int force)
+{
+
+ unsigned char *t_n = el->el_tty.t_c[ED_IO];
+ unsigned char *t_o = el->el_tty.t_ed.c_cc;
+ unsigned char new[2], old[2];
+ const ttymap_t *tp;
+ el_action_t *map, *alt;
+ const el_action_t *dmap, *dalt;
+ new[1] = old[1] = '\0';
+
+ map = el->el_map.key;
+ alt = el->el_map.alt;
+ if (el->el_map.type == MAP_VI) {
+ dmap = el->el_map.vii;
+ dalt = el->el_map.vic;
+ } else {
+ dmap = el->el_map.emacs;
+ dalt = NULL;
+ }
+
+ for (tp = tty_map; tp->nch != -1; tp++) {
+ new[0] = t_n[tp->nch];
+ old[0] = t_o[tp->och];
+ if (new[0] == old[0] && !force)
+ continue;
+ /* Put the old default binding back, and set the new binding */
+ key_clear(el, map, (char *)old);
+ map[old[0]] = dmap[old[0]];
+ key_clear(el, map, (char *)new);
+ /* MAP_VI == 1, MAP_EMACS == 0... */
+ map[new[0]] = tp->bind[el->el_map.type];
+ if (dalt) {
+ key_clear(el, alt, (char *)old);
+ alt[old[0]] = dalt[old[0]];
+ key_clear(el, alt, (char *)new);
+ alt[new[0]] = tp->bind[el->el_map.type + 1];
+ }
+ }
+}
+
+
+/* tty_rawmode():
+ * Set terminal into 1 character at a time mode.
+ */
+protected int
+tty_rawmode(EditLine *el)
+{
+
+ if (el->el_tty.t_mode == ED_IO || el->el_tty.t_mode == QU_IO)
+ return (0);
+
+ if (el->el_flags & EDIT_DISABLED)
+ return (0);
+
+ if (tty_getty(el, &el->el_tty.t_ts) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile, "tty_rawmode: tty_getty: %s\n",
+ strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ /*
+ * We always keep up with the eight bit setting and the speed of the
+ * tty. But only we only believe changes that are made to cooked mode!
+ */
+ el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ts);
+ el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts);
+
+ if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed ||
+ tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) {
+ (void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed);
+ (void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed);
+ (void) cfsetispeed(&el->el_tty.t_ed, el->el_tty.t_speed);
+ (void) cfsetospeed(&el->el_tty.t_ed, el->el_tty.t_speed);
+ }
+ if (tty__cooked_mode(&el->el_tty.t_ts)) {
+ if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) {
+ el->el_tty.t_ex.c_cflag =
+ el->el_tty.t_ts.c_cflag;
+ el->el_tty.t_ex.c_cflag &=
+ ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask;
+ el->el_tty.t_ex.c_cflag |=
+ el->el_tty.t_t[EX_IO][MD_CTL].t_setmask;
+
+ el->el_tty.t_ed.c_cflag =
+ el->el_tty.t_ts.c_cflag;
+ el->el_tty.t_ed.c_cflag &=
+ ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask;
+ el->el_tty.t_ed.c_cflag |=
+ el->el_tty.t_t[ED_IO][MD_CTL].t_setmask;
+ }
+ if ((el->el_tty.t_ts.c_lflag != el->el_tty.t_ex.c_lflag) &&
+ (el->el_tty.t_ts.c_lflag != el->el_tty.t_ed.c_lflag)) {
+ el->el_tty.t_ex.c_lflag =
+ el->el_tty.t_ts.c_lflag;
+ el->el_tty.t_ex.c_lflag &=
+ ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask;
+ el->el_tty.t_ex.c_lflag |=
+ el->el_tty.t_t[EX_IO][MD_LIN].t_setmask;
+
+ el->el_tty.t_ed.c_lflag =
+ el->el_tty.t_ts.c_lflag;
+ el->el_tty.t_ed.c_lflag &=
+ ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask;
+ el->el_tty.t_ed.c_lflag |=
+ el->el_tty.t_t[ED_IO][MD_LIN].t_setmask;
+ }
+ if ((el->el_tty.t_ts.c_iflag != el->el_tty.t_ex.c_iflag) &&
+ (el->el_tty.t_ts.c_iflag != el->el_tty.t_ed.c_iflag)) {
+ el->el_tty.t_ex.c_iflag =
+ el->el_tty.t_ts.c_iflag;
+ el->el_tty.t_ex.c_iflag &=
+ ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask;
+ el->el_tty.t_ex.c_iflag |=
+ el->el_tty.t_t[EX_IO][MD_INP].t_setmask;
+
+ el->el_tty.t_ed.c_iflag =
+ el->el_tty.t_ts.c_iflag;
+ el->el_tty.t_ed.c_iflag &=
+ ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask;
+ el->el_tty.t_ed.c_iflag |=
+ el->el_tty.t_t[ED_IO][MD_INP].t_setmask;
+ }
+ if ((el->el_tty.t_ts.c_oflag != el->el_tty.t_ex.c_oflag) &&
+ (el->el_tty.t_ts.c_oflag != el->el_tty.t_ed.c_oflag)) {
+ el->el_tty.t_ex.c_oflag =
+ el->el_tty.t_ts.c_oflag;
+ el->el_tty.t_ex.c_oflag &=
+ ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask;
+ el->el_tty.t_ex.c_oflag |=
+ el->el_tty.t_t[EX_IO][MD_OUT].t_setmask;
+
+ el->el_tty.t_ed.c_oflag =
+ el->el_tty.t_ts.c_oflag;
+ el->el_tty.t_ed.c_oflag &=
+ ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask;
+ el->el_tty.t_ed.c_oflag |=
+ el->el_tty.t_t[ED_IO][MD_OUT].t_setmask;
+ }
+ if (tty__gettabs(&el->el_tty.t_ex) == 0)
+ el->el_tty.t_tabs = 0;
+ else
+ el->el_tty.t_tabs = EL_CAN_TAB ? 1 : 0;
+
+ {
+ int i;
+
+ tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]);
+ /*
+ * Check if the user made any changes.
+ * If he did, then propagate the changes to the
+ * edit and execute data structures.
+ */
+ for (i = 0; i < C_NCC; i++)
+ if (el->el_tty.t_c[TS_IO][i] !=
+ el->el_tty.t_c[EX_IO][i])
+ break;
+
+ if (i != C_NCC) {
+ /*
+ * Propagate changes only to the unprotected
+ * chars that have been modified just now.
+ */
+ for (i = 0; i < C_NCC; i++) {
+ if (!((el->el_tty.t_t[ED_IO][MD_CHAR].t_setmask & C_SH(i)))
+ && (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i]))
+ el->el_tty.t_c[ED_IO][i] = el->el_tty.t_c[TS_IO][i];
+ if (el->el_tty.t_t[ED_IO][MD_CHAR].t_clrmask & C_SH(i))
+ el->el_tty.t_c[ED_IO][i] = el->el_tty.t_vdisable;
+ }
+ tty_bind_char(el, 0);
+ tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]);
+
+ for (i = 0; i < C_NCC; i++) {
+ if (!((el->el_tty.t_t[EX_IO][MD_CHAR].t_setmask & C_SH(i)))
+ && (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i]))
+ el->el_tty.t_c[EX_IO][i] = el->el_tty.t_c[TS_IO][i];
+ if (el->el_tty.t_t[EX_IO][MD_CHAR].t_clrmask & C_SH(i))
+ el->el_tty.t_c[EX_IO][i] = el->el_tty.t_vdisable;
+ }
+ tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);
+ }
+ }
+ }
+ if (tty_setty(el, &el->el_tty.t_ed) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n",
+ strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ el->el_tty.t_mode = ED_IO;
+ return (0);
+}
+
+
+/* tty_cookedmode():
+ * Set the tty back to normal mode
+ */
+protected int
+tty_cookedmode(EditLine *el)
+{ /* set tty in normal setup */
+
+ if (el->el_tty.t_mode == EX_IO)
+ return (0);
+
+ if (el->el_flags & EDIT_DISABLED)
+ return (0);
+
+ if (tty_setty(el, &el->el_tty.t_ex) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile,
+ "tty_cookedmode: tty_setty: %s\n",
+ strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ el->el_tty.t_mode = EX_IO;
+ return (0);
+}
+
+
+/* tty_quotemode():
+ * Turn on quote mode
+ */
+protected int
+tty_quotemode(EditLine *el)
+{
+ if (el->el_tty.t_mode == QU_IO)
+ return (0);
+
+ el->el_tty.t_qu = el->el_tty.t_ed;
+
+ el->el_tty.t_qu.c_iflag &= ~el->el_tty.t_t[QU_IO][MD_INP].t_clrmask;
+ el->el_tty.t_qu.c_iflag |= el->el_tty.t_t[QU_IO][MD_INP].t_setmask;
+
+ el->el_tty.t_qu.c_oflag &= ~el->el_tty.t_t[QU_IO][MD_OUT].t_clrmask;
+ el->el_tty.t_qu.c_oflag |= el->el_tty.t_t[QU_IO][MD_OUT].t_setmask;
+
+ el->el_tty.t_qu.c_cflag &= ~el->el_tty.t_t[QU_IO][MD_CTL].t_clrmask;
+ el->el_tty.t_qu.c_cflag |= el->el_tty.t_t[QU_IO][MD_CTL].t_setmask;
+
+ el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask;
+ el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask;
+
+ if (tty_setty(el, &el->el_tty.t_qu) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n",
+ strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ el->el_tty.t_mode = QU_IO;
+ return (0);
+}
+
+
+/* tty_noquotemode():
+ * Turn off quote mode
+ */
+protected int
+tty_noquotemode(EditLine *el)
+{
+
+ if (el->el_tty.t_mode != QU_IO)
+ return (0);
+ if (tty_setty(el, &el->el_tty.t_ed) == -1) {
+#ifdef DEBUG_TTY
+ (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n",
+ strerror(errno));
+#endif /* DEBUG_TTY */
+ return (-1);
+ }
+ el->el_tty.t_mode = ED_IO;
+ return (0);
+}
+
+
+/* tty_stty():
+ * Stty builtin
+ */
+protected int
+/*ARGSUSED*/
+tty_stty(EditLine *el, int argc __attribute__((__unused__)), const char **argv)
+{
+ const ttymodes_t *m;
+ char x;
+ int aflag = 0;
+ const char *s, *d;
+ const char *name;
+ struct termios *tios = &el->el_tty.t_ex;
+ int z = EX_IO;
+
+ if (argv == NULL)
+ return (-1);
+ name = *argv++;
+
+ while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0')
+ switch (argv[0][1]) {
+ case 'a':
+ aflag++;
+ argv++;
+ break;
+ case 'd':
+ argv++;
+ tios = &el->el_tty.t_ed;
+ z = ED_IO;
+ break;
+ case 'x':
+ argv++;
+ tios = &el->el_tty.t_ex;
+ z = EX_IO;
+ break;
+ case 'q':
+ argv++;
+ tios = &el->el_tty.t_ts;
+ z = QU_IO;
+ break;
+ default:
+ (void) fprintf(el->el_errfile,
+ "%s: Unknown switch `%c'.\n",
+ name, argv[0][1]);
+ return (-1);
+ }
+
+ if (!argv || !*argv) {
+ int i = -1;
+ int len = 0, st = 0, cu;
+ for (m = ttymodes; m->m_name; m++) {
+ if (m->m_type != i) {
+ (void) fprintf(el->el_outfile, "%s%s",
+ i != -1 ? "\n" : "",
+ el->el_tty.t_t[z][m->m_type].t_name);
+ i = m->m_type;
+ st = len =
+ strlen(el->el_tty.t_t[z][m->m_type].t_name);
+ }
+ if (i != -1) {
+ x = (el->el_tty.t_t[z][i].t_setmask & m->m_value)
+ ? '+' : '\0';
+ x = (el->el_tty.t_t[z][i].t_clrmask & m->m_value)
+ ? '-' : x;
+ } else {
+ x = '\0';
+ }
+
+ if (x != '\0' || aflag) {
+
+ cu = strlen(m->m_name) + (x != '\0') + 1;
+
+ if (len + cu >= el->el_term.t_size.h) {
+ (void) fprintf(el->el_outfile, "\n%*s",
+ st, "");
+ len = st + cu;
+ } else
+ len += cu;
+
+ if (x != '\0')
+ (void) fprintf(el->el_outfile, "%c%s ",
+ x, m->m_name);
+ else
+ (void) fprintf(el->el_outfile, "%s ",
+ m->m_name);
+ }
+ }
+ (void) fprintf(el->el_outfile, "\n");
+ return (0);
+ }
+ while (argv && (s = *argv++)) {
+ const char *p;
+ switch (*s) {
+ case '+':
+ case '-':
+ x = *s++;
+ break;
+ default:
+ x = '\0';
+ break;
+ }
+ d = s;
+ p = strchr(s, '=');
+ for (m = ttymodes; m->m_name; m++)
+ if ((p ? strncmp(m->m_name, d, (size_t)(p - d)) :
+ strcmp(m->m_name, d)) == 0 &&
+ (p == NULL || m->m_type == MD_CHAR))
+ break;
+
+ if (!m->m_name) {
+ (void) fprintf(el->el_errfile,
+ "%s: Invalid argument `%s'.\n", name, d);
+ return (-1);
+ }
+ if (p) {
+ int c = ffs((int)m->m_value);
+ int v = *++p ? parse__escape((const char **) &p) :
+ el->el_tty.t_vdisable;
+ assert(c-- != 0);
+ c = tty__getcharindex(c);
+ assert(c != -1);
+ tios->c_cc[c] = v;
+ continue;
+ }
+ switch (x) {
+ case '+':
+ el->el_tty.t_t[z][m->m_type].t_setmask |= m->m_value;
+ el->el_tty.t_t[z][m->m_type].t_clrmask &= ~m->m_value;
+ break;
+ case '-':
+ el->el_tty.t_t[z][m->m_type].t_setmask &= ~m->m_value;
+ el->el_tty.t_t[z][m->m_type].t_clrmask |= m->m_value;
+ break;
+ default:
+ el->el_tty.t_t[z][m->m_type].t_setmask &= ~m->m_value;
+ el->el_tty.t_t[z][m->m_type].t_clrmask &= ~m->m_value;
+ break;
+ }
+ }
+ return (0);
+}
+
+
+#ifdef notyet
+/* tty_printchar():
+ * DEbugging routine to print the tty characters
+ */
+private void
+tty_printchar(EditLine *el, unsigned char *s)
+{
+ ttyperm_t *m;
+ int i;
+
+ for (i = 0; i < C_NCC; i++) {
+ for (m = el->el_tty.t_t; m->m_name; m++)
+ if (m->m_type == MD_CHAR && C_SH(i) == m->m_value)
+ break;
+ if (m->m_name)
+ (void) fprintf(el->el_errfile, "%s ^%c ",
+ m->m_name, s[i] + 'A' - 1);
+ if (i % 5 == 0)
+ (void) fprintf(el->el_errfile, "\n");
+ }
+ (void) fprintf(el->el_errfile, "\n");
+}
+#endif /* notyet */
diff --git a/frontend/libedit/tty.h b/frontend/libedit/tty.h
new file mode 100644
index 0000000..10e9b98
--- /dev/null
+++ b/frontend/libedit/tty.h
@@ -0,0 +1,480 @@
+/* $NetBSD: tty.h,v 1.11 2005/06/01 11:37:52 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)tty.h 8.1 (Berkeley) 6/4/93
+ */
+
+/*
+ * el.tty.h: Local terminal header
+ */
+#ifndef _h_el_tty
+#define _h_el_tty
+
+#include "histedit.h"
+#include <termios.h>
+#include <unistd.h>
+
+/* Define our own since everyone gets it wrong! */
+#define CONTROL(A) ((A) & 037)
+
+/*
+ * Aix compatible names
+ */
+# if defined(VWERSE) && !defined(VWERASE)
+# define VWERASE VWERSE
+# endif /* VWERSE && !VWERASE */
+
+# if defined(VDISCRD) && !defined(VDISCARD)
+# define VDISCARD VDISCRD
+# endif /* VDISCRD && !VDISCARD */
+
+# if defined(VFLUSHO) && !defined(VDISCARD)
+# define VDISCARD VFLUSHO
+# endif /* VFLUSHO && VDISCARD */
+
+# if defined(VSTRT) && !defined(VSTART)
+# define VSTART VSTRT
+# endif /* VSTRT && ! VSTART */
+
+# if defined(VSTAT) && !defined(VSTATUS)
+# define VSTATUS VSTAT
+# endif /* VSTAT && ! VSTATUS */
+
+# ifndef ONLRET
+# define ONLRET 0
+# endif /* ONLRET */
+
+# ifndef TAB3
+# ifdef OXTABS
+# define TAB3 OXTABS
+# else
+# define TAB3 0
+# endif /* OXTABS */
+# endif /* !TAB3 */
+
+# if defined(OXTABS) && !defined(XTABS)
+# define XTABS OXTABS
+# endif /* OXTABS && !XTABS */
+
+# ifndef ONLCR
+# define ONLCR 0
+# endif /* ONLCR */
+
+# ifndef IEXTEN
+# define IEXTEN 0
+# endif /* IEXTEN */
+
+# ifndef ECHOCTL
+# define ECHOCTL 0
+# endif /* ECHOCTL */
+
+# ifndef PARENB
+# define PARENB 0
+# endif /* PARENB */
+
+# ifndef EXTPROC
+# define EXTPROC 0
+# endif /* EXTPROC */
+
+# ifndef FLUSHO
+# define FLUSHO 0
+# endif /* FLUSHO */
+
+
+# if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
+# define _POSIX_VDISABLE VDISABLE
+# endif /* VDISABLE && ! _POSIX_VDISABLE */
+
+/*
+ * Work around ISC's definition of IEXTEN which is
+ * XCASE!
+ */
+# ifdef ISC
+# if defined(IEXTEN) && defined(XCASE)
+# if IEXTEN == XCASE
+# undef IEXTEN
+# define IEXTEN 0
+# endif /* IEXTEN == XCASE */
+# endif /* IEXTEN && XCASE */
+# if defined(IEXTEN) && !defined(XCASE)
+# define XCASE IEXTEN
+# undef IEXTEN
+# define IEXTEN 0
+# endif /* IEXTEN && !XCASE */
+# endif /* ISC */
+
+/*
+ * Work around convex weirdness where turning off IEXTEN makes us
+ * lose all postprocessing!
+ */
+#if defined(convex) || defined(__convex__)
+# if defined(IEXTEN) && IEXTEN != 0
+# undef IEXTEN
+# define IEXTEN 0
+# endif /* IEXTEN != 0 */
+#endif /* convex || __convex__ */
+
+/*
+ * So that we don't lose job control.
+ */
+#ifdef __SVR4
+# undef CSWTCH
+#endif
+
+#ifndef _POSIX_VDISABLE
+# define _POSIX_VDISABLE ((unsigned char) -1)
+#endif /* _POSIX_VDISABLE */
+
+#if !defined(CREPRINT) && defined(CRPRNT)
+# define CREPRINT CRPRNT
+#endif /* !CREPRINT && CRPRNT */
+#if !defined(CDISCARD) && defined(CFLUSH)
+# define CDISCARD CFLUSH
+#endif /* !CDISCARD && CFLUSH */
+
+#ifndef CINTR
+# define CINTR CONTROL('c')
+#endif /* CINTR */
+#ifndef CQUIT
+# define CQUIT 034 /* ^\ */
+#endif /* CQUIT */
+#ifndef CERASE
+# define CERASE 0177 /* ^? */
+#endif /* CERASE */
+#ifndef CKILL
+# define CKILL CONTROL('u')
+#endif /* CKILL */
+#ifndef CEOF
+# define CEOF CONTROL('d')
+#endif /* CEOF */
+#ifndef CEOL
+# define CEOL _POSIX_VDISABLE
+#endif /* CEOL */
+#ifndef CEOL2
+# define CEOL2 _POSIX_VDISABLE
+#endif /* CEOL2 */
+#ifndef CSWTCH
+# define CSWTCH _POSIX_VDISABLE
+#endif /* CSWTCH */
+#ifndef CDSWTCH
+# define CDSWTCH _POSIX_VDISABLE
+#endif /* CDSWTCH */
+#ifndef CERASE2
+# define CERASE2 _POSIX_VDISABLE
+#endif /* CERASE2 */
+#ifndef CSTART
+# define CSTART CONTROL('q')
+#endif /* CSTART */
+#ifndef CSTOP
+# define CSTOP CONTROL('s')
+#endif /* CSTOP */
+#ifndef CSUSP
+# define CSUSP CONTROL('z')
+#endif /* CSUSP */
+#ifndef CDSUSP
+# define CDSUSP CONTROL('y')
+#endif /* CDSUSP */
+
+#ifdef hpux
+
+# ifndef CREPRINT
+# define CREPRINT _POSIX_VDISABLE
+# endif /* CREPRINT */
+# ifndef CDISCARD
+# define CDISCARD _POSIX_VDISABLE
+# endif /* CDISCARD */
+# ifndef CLNEXT
+# define CLNEXT _POSIX_VDISABLE
+# endif /* CLNEXT */
+# ifndef CWERASE
+# define CWERASE _POSIX_VDISABLE
+# endif /* CWERASE */
+
+#else /* !hpux */
+
+# ifndef CREPRINT
+# define CREPRINT CONTROL('r')
+# endif /* CREPRINT */
+# ifndef CDISCARD
+# define CDISCARD CONTROL('o')
+# endif /* CDISCARD */
+# ifndef CLNEXT
+# define CLNEXT CONTROL('v')
+# endif /* CLNEXT */
+# ifndef CWERASE
+# define CWERASE CONTROL('w')
+# endif /* CWERASE */
+
+#endif /* hpux */
+
+#ifndef CSTATUS
+# define CSTATUS CONTROL('t')
+#endif /* CSTATUS */
+#ifndef CPAGE
+# define CPAGE ' '
+#endif /* CPAGE */
+#ifndef CPGOFF
+# define CPGOFF CONTROL('m')
+#endif /* CPGOFF */
+#ifndef CKILL2
+# define CKILL2 _POSIX_VDISABLE
+#endif /* CKILL2 */
+#ifndef CBRK
+# ifndef masscomp
+# define CBRK 0377
+# else
+# define CBRK '\0'
+# endif /* masscomp */
+#endif /* CBRK */
+#ifndef CMIN
+# define CMIN CEOF
+#endif /* CMIN */
+#ifndef CTIME
+# define CTIME CEOL
+#endif /* CTIME */
+
+/*
+ * Fix for sun inconsistency. On termio VSUSP and the rest of the
+ * ttychars > NCC are defined. So we undefine them.
+ */
+#if defined(TERMIO) || defined(POSIX)
+# if defined(POSIX) && defined(NCCS)
+# define NUMCC NCCS
+# else
+# ifdef NCC
+# define NUMCC NCC
+# endif /* NCC */
+# endif /* POSIX && NCCS */
+# ifdef NUMCC
+# ifdef VINTR
+# if NUMCC <= VINTR
+# undef VINTR
+# endif /* NUMCC <= VINTR */
+# endif /* VINTR */
+# ifdef VQUIT
+# if NUMCC <= VQUIT
+# undef VQUIT
+# endif /* NUMCC <= VQUIT */
+# endif /* VQUIT */
+# ifdef VERASE
+# if NUMCC <= VERASE
+# undef VERASE
+# endif /* NUMCC <= VERASE */
+# endif /* VERASE */
+# ifdef VKILL
+# if NUMCC <= VKILL
+# undef VKILL
+# endif /* NUMCC <= VKILL */
+# endif /* VKILL */
+# ifdef VEOF
+# if NUMCC <= VEOF
+# undef VEOF
+# endif /* NUMCC <= VEOF */
+# endif /* VEOF */
+# ifdef VEOL
+# if NUMCC <= VEOL
+# undef VEOL
+# endif /* NUMCC <= VEOL */
+# endif /* VEOL */
+# ifdef VEOL2
+# if NUMCC <= VEOL2
+# undef VEOL2
+# endif /* NUMCC <= VEOL2 */
+# endif /* VEOL2 */
+# ifdef VSWTCH
+# if NUMCC <= VSWTCH
+# undef VSWTCH
+# endif /* NUMCC <= VSWTCH */
+# endif /* VSWTCH */
+# ifdef VDSWTCH
+# if NUMCC <= VDSWTCH
+# undef VDSWTCH
+# endif /* NUMCC <= VDSWTCH */
+# endif /* VDSWTCH */
+# ifdef VERASE2
+# if NUMCC <= VERASE2
+# undef VERASE2
+# endif /* NUMCC <= VERASE2 */
+# endif /* VERASE2 */
+# ifdef VSTART
+# if NUMCC <= VSTART
+# undef VSTART
+# endif /* NUMCC <= VSTART */
+# endif /* VSTART */
+# ifdef VSTOP
+# if NUMCC <= VSTOP
+# undef VSTOP
+# endif /* NUMCC <= VSTOP */
+# endif /* VSTOP */
+# ifdef VWERASE
+# if NUMCC <= VWERASE
+# undef VWERASE
+# endif /* NUMCC <= VWERASE */
+# endif /* VWERASE */
+# ifdef VSUSP
+# if NUMCC <= VSUSP
+# undef VSUSP
+# endif /* NUMCC <= VSUSP */
+# endif /* VSUSP */
+# ifdef VDSUSP
+# if NUMCC <= VDSUSP
+# undef VDSUSP
+# endif /* NUMCC <= VDSUSP */
+# endif /* VDSUSP */
+# ifdef VREPRINT
+# if NUMCC <= VREPRINT
+# undef VREPRINT
+# endif /* NUMCC <= VREPRINT */
+# endif /* VREPRINT */
+# ifdef VDISCARD
+# if NUMCC <= VDISCARD
+# undef VDISCARD
+# endif /* NUMCC <= VDISCARD */
+# endif /* VDISCARD */
+# ifdef VLNEXT
+# if NUMCC <= VLNEXT
+# undef VLNEXT
+# endif /* NUMCC <= VLNEXT */
+# endif /* VLNEXT */
+# ifdef VSTATUS
+# if NUMCC <= VSTATUS
+# undef VSTATUS
+# endif /* NUMCC <= VSTATUS */
+# endif /* VSTATUS */
+# ifdef VPAGE
+# if NUMCC <= VPAGE
+# undef VPAGE
+# endif /* NUMCC <= VPAGE */
+# endif /* VPAGE */
+# ifdef VPGOFF
+# if NUMCC <= VPGOFF
+# undef VPGOFF
+# endif /* NUMCC <= VPGOFF */
+# endif /* VPGOFF */
+# ifdef VKILL2
+# if NUMCC <= VKILL2
+# undef VKILL2
+# endif /* NUMCC <= VKILL2 */
+# endif /* VKILL2 */
+# ifdef VBRK
+# if NUMCC <= VBRK
+# undef VBRK
+# endif /* NUMCC <= VBRK */
+# endif /* VBRK */
+# ifdef VMIN
+# if NUMCC <= VMIN
+# undef VMIN
+# endif /* NUMCC <= VMIN */
+# endif /* VMIN */
+# ifdef VTIME
+# if NUMCC <= VTIME
+# undef VTIME
+# endif /* NUMCC <= VTIME */
+# endif /* VTIME */
+# endif /* NUMCC */
+#endif /* !POSIX */
+
+#define C_INTR 0
+#define C_QUIT 1
+#define C_ERASE 2
+#define C_KILL 3
+#define C_EOF 4
+#define C_EOL 5
+#define C_EOL2 6
+#define C_SWTCH 7
+#define C_DSWTCH 8
+#define C_ERASE2 9
+#define C_START 10
+#define C_STOP 11
+#define C_WERASE 12
+#define C_SUSP 13
+#define C_DSUSP 14
+#define C_REPRINT 15
+#define C_DISCARD 16
+#define C_LNEXT 17
+#define C_STATUS 18
+#define C_PAGE 19
+#define C_PGOFF 20
+#define C_KILL2 21
+#define C_BRK 22
+#define C_MIN 23
+#define C_TIME 24
+#define C_NCC 25
+#define C_SH(A) (1 << (A))
+
+/*
+ * Terminal dependend data structures
+ */
+#define EX_IO 0 /* while we are executing */
+#define ED_IO 1 /* while we are editing */
+#define TS_IO 2 /* new mode from terminal */
+#define QU_IO 2 /* used only for quoted chars */
+#define NN_IO 3 /* The number of entries */
+
+#define MD_INP 0
+#define MD_OUT 1
+#define MD_CTL 2
+#define MD_LIN 3
+#define MD_CHAR 4
+#define MD_NN 5
+
+typedef struct {
+ const char *t_name;
+ unsigned int t_setmask;
+ unsigned int t_clrmask;
+} ttyperm_t[NN_IO][MD_NN];
+
+typedef unsigned char ttychar_t[NN_IO][C_NCC];
+
+protected int tty_init(EditLine *);
+protected void tty_end(EditLine *);
+protected int tty_stty(EditLine *, int, const char **);
+protected int tty_rawmode(EditLine *);
+protected int tty_cookedmode(EditLine *);
+protected int tty_quotemode(EditLine *);
+protected int tty_noquotemode(EditLine *);
+protected void tty_bind_char(EditLine *, int);
+
+typedef struct {
+ ttyperm_t t_t;
+ ttychar_t t_c;
+ struct termios t_ex, t_ed, t_ts;
+ int t_tabs;
+ int t_eight;
+ speed_t t_speed;
+ int t_mode;
+ unsigned char t_vdisable;
+} el_tty_t;
+
+
+#endif /* _h_el_tty */
diff --git a/frontend/libedit/unvis.c b/frontend/libedit/unvis.c
new file mode 100644
index 0000000..8b99122
--- /dev/null
+++ b/frontend/libedit/unvis.c
@@ -0,0 +1,301 @@
+/* $NetBSD: unvis.c,v 1.28 2005/09/13 01:44:09 christos Exp $ */
+
+/*-
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+#include <sys/types.h>
+
+#include <assert.h>
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(x) assert(x)
+#endif
+#include <ctype.h>
+#include <stdio.h>
+#include <vis.h>
+
+#ifdef __weak_alias
+__weak_alias(strunvis,_strunvis)
+#endif
+
+#if !HAVE_VIS
+/*
+ * decode driven by state machine
+ */
+#define S_GROUND 0 /* haven't seen escape char */
+#define S_START 1 /* start decoding special sequence */
+#define S_META 2 /* metachar started (M) */
+#define S_META1 3 /* metachar more, regular char (-) */
+#define S_CTRL 4 /* control char started (^) */
+#define S_OCTAL2 5 /* octal digit 2 */
+#define S_OCTAL3 6 /* octal digit 3 */
+#define S_HEX1 7 /* hex digit */
+#define S_HEX2 8 /* hex digit 2 */
+
+#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
+#define xtod(c) (isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10))
+
+/*
+ * unvis - decode characters previously encoded by vis
+ */
+int
+unvis(cp, c, astate, flag)
+ char *cp;
+ int c;
+ int *astate, flag;
+{
+ unsigned char uc = (unsigned char)c;
+
+ _DIAGASSERT(cp != NULL);
+ _DIAGASSERT(astate != NULL);
+
+ if (flag & UNVIS_END) {
+ if (*astate == S_OCTAL2 || *astate == S_OCTAL3
+ || *astate == S_HEX2) {
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ }
+ return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD);
+ }
+
+ switch (*astate) {
+
+ case S_GROUND:
+ *cp = 0;
+ if (c == '\\') {
+ *astate = S_START;
+ return (0);
+ }
+ if ((flag & VIS_HTTPSTYLE) && c == '%') {
+ *astate = S_HEX1;
+ return (0);
+ }
+ *cp = c;
+ return (UNVIS_VALID);
+
+ case S_START:
+ switch(c) {
+ case '\\':
+ *cp = c;
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ *cp = (c - '0');
+ *astate = S_OCTAL2;
+ return (0);
+ case 'M':
+ *cp = (char)0200;
+ *astate = S_META;
+ return (0);
+ case '^':
+ *astate = S_CTRL;
+ return (0);
+ case 'n':
+ *cp = '\n';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 'r':
+ *cp = '\r';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 'b':
+ *cp = '\b';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 'a':
+ *cp = '\007';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 'v':
+ *cp = '\v';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 't':
+ *cp = '\t';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 'f':
+ *cp = '\f';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 's':
+ *cp = ' ';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case 'E':
+ *cp = '\033';
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+ case '\n':
+ /*
+ * hidden newline
+ */
+ *astate = S_GROUND;
+ return (UNVIS_NOCHAR);
+ case '$':
+ /*
+ * hidden marker
+ */
+ *astate = S_GROUND;
+ return (UNVIS_NOCHAR);
+ }
+ *astate = S_GROUND;
+ return (UNVIS_SYNBAD);
+
+ case S_META:
+ if (c == '-')
+ *astate = S_META1;
+ else if (c == '^')
+ *astate = S_CTRL;
+ else {
+ *astate = S_GROUND;
+ return (UNVIS_SYNBAD);
+ }
+ return (0);
+
+ case S_META1:
+ *astate = S_GROUND;
+ *cp |= c;
+ return (UNVIS_VALID);
+
+ case S_CTRL:
+ if (c == '?')
+ *cp |= 0177;
+ else
+ *cp |= c & 037;
+ *astate = S_GROUND;
+ return (UNVIS_VALID);
+
+ case S_OCTAL2: /* second possible octal digit */
+ if (isoctal(uc)) {
+ /*
+ * yes - and maybe a third
+ */
+ *cp = (*cp << 3) + (c - '0');
+ *astate = S_OCTAL3;
+ return (0);
+ }
+ /*
+ * no - done with current sequence, push back passed char
+ */
+ *astate = S_GROUND;
+ return (UNVIS_VALIDPUSH);
+
+ case S_OCTAL3: /* third possible octal digit */
+ *astate = S_GROUND;
+ if (isoctal(uc)) {
+ *cp = (*cp << 3) + (c - '0');
+ return (UNVIS_VALID);
+ }
+ /*
+ * we were done, push back passed char
+ */
+ return (UNVIS_VALIDPUSH);
+
+ case S_HEX1:
+ if (isxdigit(uc)) {
+ *cp = xtod(uc);
+ *astate = S_HEX2;
+ return (0);
+ }
+ /*
+ * no - done with current sequence, push back passed char
+ */
+ *astate = S_GROUND;
+ return (UNVIS_VALIDPUSH);
+
+ case S_HEX2:
+ *astate = S_GROUND;
+ if (isxdigit(uc)) {
+ *cp = xtod(uc) | (*cp << 4);
+ return (UNVIS_VALID);
+ }
+ return (UNVIS_VALIDPUSH);
+
+ default:
+ /*
+ * decoder in unknown state - (probably uninitialized)
+ */
+ *astate = S_GROUND;
+ return (UNVIS_SYNBAD);
+ }
+}
+
+/*
+ * strunvis - decode src into dst
+ *
+ * Number of chars decoded into dst is returned, -1 on error.
+ * Dst is null terminated.
+ */
+
+int
+strunvisx(dst, src, flag)
+ char *dst;
+ const char *src;
+ int flag;
+{
+ char c;
+ char *start = dst;
+ int state = 0;
+
+ _DIAGASSERT(src != NULL);
+ _DIAGASSERT(dst != NULL);
+
+ while ((c = *src++) != '\0') {
+ again:
+ switch (unvis(dst, c, &state, flag)) {
+ case UNVIS_VALID:
+ dst++;
+ break;
+ case UNVIS_VALIDPUSH:
+ dst++;
+ goto again;
+ case 0:
+ case UNVIS_NOCHAR:
+ break;
+ default:
+ return (-1);
+ }
+ }
+ if (unvis(dst, c, &state, UNVIS_END) == UNVIS_VALID)
+ dst++;
+ *dst = '\0';
+ return (dst - start);
+}
+
+int
+strunvis(dst, src)
+ char *dst;
+ const char *src;
+{
+ return strunvisx(dst, src, 0);
+}
+#endif
diff --git a/frontend/libedit/vi.c b/frontend/libedit/vi.c
new file mode 100644
index 0000000..bfcc2a2
--- /dev/null
+++ b/frontend/libedit/vi.c
@@ -0,0 +1,1118 @@
+/* $NetBSD: vi.c,v 1.27 2006/10/22 07:48:13 mrg Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Christos Zoulas of Cornell University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "sys.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+/*
+ * vi.c: Vi mode commands.
+ */
+#include "el.h"
+
+private el_action_t cv_action(EditLine *, int);
+private el_action_t cv_paste(EditLine *, int);
+
+/* cv_action():
+ * Handle vi actions.
+ */
+private el_action_t
+cv_action(EditLine *el, int c)
+{
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ /* 'cc', 'dd' and (possibly) friends */
+ if (c != el->el_chared.c_vcmd.action)
+ return CC_ERROR;
+
+ if (!(c & YANK))
+ cv_undo(el);
+ cv_yank(el, el->el_line.buffer,
+ el->el_line.lastchar - el->el_line.buffer);
+ el->el_chared.c_vcmd.action = NOP;
+ el->el_chared.c_vcmd.pos = 0;
+ if (!(c & YANK)) {
+ el->el_line.lastchar = el->el_line.buffer;
+ el->el_line.cursor = el->el_line.buffer;
+ }
+ if (c & INSERT)
+ el->el_map.current = el->el_map.key;
+
+ return (CC_REFRESH);
+ }
+ el->el_chared.c_vcmd.pos = el->el_line.cursor;
+ el->el_chared.c_vcmd.action = c;
+ return (CC_ARGHACK);
+}
+
+/* cv_paste():
+ * Paste previous deletion before or after the cursor
+ */
+private el_action_t
+cv_paste(EditLine *el, int c)
+{
+ c_kill_t *k = &el->el_chared.c_kill;
+ int len = k->last - k->buf;
+
+ if (k->buf == NULL || len == 0)
+ return (CC_ERROR);
+#ifdef DEBUG_PASTE
+ (void) fprintf(el->el_errfile, "Paste: \"%.*s\"\n", len, k->buf);
+#endif
+
+ cv_undo(el);
+
+ if (!c && el->el_line.cursor < el->el_line.lastchar)
+ el->el_line.cursor++;
+
+ c_insert(el, len);
+ if (el->el_line.cursor + len > el->el_line.lastchar)
+ return (CC_ERROR);
+ (void) memcpy(el->el_line.cursor, k->buf, len +0u);
+
+ return (CC_REFRESH);
+}
+
+
+/* vi_paste_next():
+ * Vi paste previous deletion to the right of the cursor
+ * [p]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_paste_next(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return (cv_paste(el, 0));
+}
+
+
+/* vi_paste_prev():
+ * Vi paste previous deletion to the left of the cursor
+ * [P]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_paste_prev(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return (cv_paste(el, 1));
+}
+
+
+/* vi_prev_big_word():
+ * Vi move to the previous space delimited word
+ * [B]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_prev_big_word(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor == el->el_line.buffer)
+ return (CC_ERROR);
+
+ el->el_line.cursor = cv_prev_word(el->el_line.cursor,
+ el->el_line.buffer,
+ el->el_state.argument,
+ cv__isWord);
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_prev_word():
+ * Vi move to the previous word
+ * [b]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_prev_word(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor == el->el_line.buffer)
+ return (CC_ERROR);
+
+ el->el_line.cursor = cv_prev_word(el->el_line.cursor,
+ el->el_line.buffer,
+ el->el_state.argument,
+ cv__isword);
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_next_big_word():
+ * Vi move to the next space delimited word
+ * [W]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_next_big_word(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor >= el->el_line.lastchar - 1)
+ return (CC_ERROR);
+
+ el->el_line.cursor = cv_next_word(el, el->el_line.cursor,
+ el->el_line.lastchar, el->el_state.argument, cv__isWord);
+
+ if (el->el_map.type == MAP_VI)
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_next_word():
+ * Vi move to the next word
+ * [w]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_next_word(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor >= el->el_line.lastchar - 1)
+ return (CC_ERROR);
+
+ el->el_line.cursor = cv_next_word(el, el->el_line.cursor,
+ el->el_line.lastchar, el->el_state.argument, cv__isword);
+
+ if (el->el_map.type == MAP_VI)
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_change_case():
+ * Vi change case of character under the cursor and advance one character
+ * [~]
+ */
+protected el_action_t
+vi_change_case(EditLine *el, int c)
+{
+ int i;
+
+ if (el->el_line.cursor >= el->el_line.lastchar)
+ return (CC_ERROR);
+ cv_undo(el);
+ for (i = 0; i < el->el_state.argument; i++) {
+
+ c = *(unsigned char *)el->el_line.cursor;
+ if (isupper(c))
+ *el->el_line.cursor = tolower(c);
+ else if (islower(c))
+ *el->el_line.cursor = toupper(c);
+
+ if (++el->el_line.cursor >= el->el_line.lastchar) {
+ el->el_line.cursor--;
+ re_fastaddc(el);
+ break;
+ }
+ re_fastaddc(el);
+ }
+ return CC_NORM;
+}
+
+
+/* vi_change_meta():
+ * Vi change prefix command
+ * [c]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_change_meta(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ /*
+ * Delete with insert == change: first we delete and then we leave in
+ * insert mode.
+ */
+ return (cv_action(el, DELETE | INSERT));
+}
+
+
+/* vi_insert_at_bol():
+ * Vi enter insert mode at the beginning of line
+ * [I]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_insert_at_bol(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_line.cursor = el->el_line.buffer;
+ cv_undo(el);
+ el->el_map.current = el->el_map.key;
+ return (CC_CURSOR);
+}
+
+
+/* vi_replace_char():
+ * Vi replace character under the cursor with the next character typed
+ * [r]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_replace_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor >= el->el_line.lastchar)
+ return CC_ERROR;
+
+ el->el_map.current = el->el_map.key;
+ el->el_state.inputmode = MODE_REPLACE_1;
+ cv_undo(el);
+ return (CC_ARGHACK);
+}
+
+
+/* vi_replace_mode():
+ * Vi enter replace mode
+ * [R]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_replace_mode(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_map.current = el->el_map.key;
+ el->el_state.inputmode = MODE_REPLACE;
+ cv_undo(el);
+ return (CC_NORM);
+}
+
+
+/* vi_substitute_char():
+ * Vi replace character under the cursor and enter insert mode
+ * [s]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_substitute_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ c_delafter(el, el->el_state.argument);
+ el->el_map.current = el->el_map.key;
+ return (CC_REFRESH);
+}
+
+
+/* vi_substitute_line():
+ * Vi substitute entire line
+ * [S]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_substitute_line(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ cv_undo(el);
+ cv_yank(el, el->el_line.buffer,
+ el->el_line.lastchar - el->el_line.buffer);
+ (void) em_kill_line(el, 0);
+ el->el_map.current = el->el_map.key;
+ return (CC_REFRESH);
+}
+
+
+/* vi_change_to_eol():
+ * Vi change to end of line
+ * [C]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_change_to_eol(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ cv_undo(el);
+ cv_yank(el, el->el_line.cursor,
+ el->el_line.lastchar - el->el_line.cursor);
+ (void) ed_kill_line(el, 0);
+ el->el_map.current = el->el_map.key;
+ return (CC_REFRESH);
+}
+
+
+/* vi_insert():
+ * Vi enter insert mode
+ * [i]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_insert(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_map.current = el->el_map.key;
+ cv_undo(el);
+ return (CC_NORM);
+}
+
+
+/* vi_add():
+ * Vi enter insert mode after the cursor
+ * [a]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_add(EditLine *el, int c __attribute__((__unused__)))
+{
+ int ret;
+
+ el->el_map.current = el->el_map.key;
+ if (el->el_line.cursor < el->el_line.lastchar) {
+ el->el_line.cursor++;
+ if (el->el_line.cursor > el->el_line.lastchar)
+ el->el_line.cursor = el->el_line.lastchar;
+ ret = CC_CURSOR;
+ } else
+ ret = CC_NORM;
+
+ cv_undo(el);
+
+ return (ret);
+}
+
+
+/* vi_add_at_eol():
+ * Vi enter insert mode at end of line
+ * [A]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_add_at_eol(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ el->el_map.current = el->el_map.key;
+ el->el_line.cursor = el->el_line.lastchar;
+ cv_undo(el);
+ return (CC_CURSOR);
+}
+
+
+/* vi_delete_meta():
+ * Vi delete prefix command
+ * [d]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_delete_meta(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return (cv_action(el, DELETE));
+}
+
+
+/* vi_end_big_word():
+ * Vi move to the end of the current space delimited word
+ * [E]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_end_big_word(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor == el->el_line.lastchar)
+ return (CC_ERROR);
+
+ el->el_line.cursor = cv__endword(el->el_line.cursor,
+ el->el_line.lastchar, el->el_state.argument, cv__isWord);
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ el->el_line.cursor++;
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_end_word():
+ * Vi move to the end of the current word
+ * [e]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_end_word(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor == el->el_line.lastchar)
+ return (CC_ERROR);
+
+ el->el_line.cursor = cv__endword(el->el_line.cursor,
+ el->el_line.lastchar, el->el_state.argument, cv__isword);
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ el->el_line.cursor++;
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_undo():
+ * Vi undo last change
+ * [u]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_undo(EditLine *el, int c __attribute__((__unused__)))
+{
+ c_undo_t un = el->el_chared.c_undo;
+
+ if (un.len == -1)
+ return CC_ERROR;
+
+ /* switch line buffer and undo buffer */
+ el->el_chared.c_undo.buf = el->el_line.buffer;
+ el->el_chared.c_undo.len = el->el_line.lastchar - el->el_line.buffer;
+ el->el_chared.c_undo.cursor = el->el_line.cursor - el->el_line.buffer;
+ el->el_line.limit = un.buf + (el->el_line.limit - el->el_line.buffer);
+ el->el_line.buffer = un.buf;
+ el->el_line.cursor = un.buf + un.cursor;
+ el->el_line.lastchar = un.buf + un.len;
+
+ return (CC_REFRESH);
+}
+
+
+/* vi_command_mode():
+ * Vi enter command mode (use alternative key bindings)
+ * [<ESC>]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_command_mode(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ /* [Esc] cancels pending action */
+ el->el_chared.c_vcmd.action = NOP;
+ el->el_chared.c_vcmd.pos = 0;
+
+ el->el_state.doingarg = 0;
+
+ el->el_state.inputmode = MODE_INSERT;
+ el->el_map.current = el->el_map.alt;
+#ifdef VI_MOVE
+ if (el->el_line.cursor > el->el_line.buffer)
+ el->el_line.cursor--;
+#endif
+ return (CC_CURSOR);
+}
+
+
+/* vi_zero():
+ * Vi move to the beginning of line
+ * [0]
+ */
+protected el_action_t
+vi_zero(EditLine *el, int c)
+{
+
+ if (el->el_state.doingarg)
+ return ed_argument_digit(el, c);
+
+ el->el_line.cursor = el->el_line.buffer;
+ if (el->el_chared.c_vcmd.action != NOP) {
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+
+/* vi_delete_prev_char():
+ * Vi move to previous character (backspace)
+ * [^H] in insert mode only
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_line.cursor <= el->el_line.buffer)
+ return (CC_ERROR);
+
+ c_delbefore1(el);
+ el->el_line.cursor--;
+ return (CC_REFRESH);
+}
+
+
+/* vi_list_or_eof():
+ * Vi list choices for completion or indicate end of file if empty line
+ * [^D]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_list_or_eof(EditLine *el, int c)
+{
+
+ if (el->el_line.cursor == el->el_line.lastchar) {
+ if (el->el_line.cursor == el->el_line.buffer) {
+ term_writec(el, c); /* then do a EOF */
+ return (CC_EOF);
+ } else {
+ /*
+ * Here we could list completions, but it is an
+ * error right now
+ */
+ term_beep(el);
+ return (CC_ERROR);
+ }
+ } else {
+#ifdef notyet
+ re_goto_bottom(el);
+ *el->el_line.lastchar = '\0'; /* just in case */
+ return (CC_LIST_CHOICES);
+#else
+ /*
+ * Just complain for now.
+ */
+ term_beep(el);
+ return (CC_ERROR);
+#endif
+ }
+}
+
+
+/* vi_kill_line_prev():
+ * Vi cut from beginning of line to cursor
+ * [^U]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_kill_line_prev(EditLine *el, int c __attribute__((__unused__)))
+{
+ char *kp, *cp;
+
+ cp = el->el_line.buffer;
+ kp = el->el_chared.c_kill.buf;
+ while (cp < el->el_line.cursor)
+ *kp++ = *cp++; /* copy it */
+ el->el_chared.c_kill.last = kp;
+ c_delbefore(el, el->el_line.cursor - el->el_line.buffer);
+ el->el_line.cursor = el->el_line.buffer; /* zap! */
+ return (CC_REFRESH);
+}
+
+
+/* vi_search_prev():
+ * Vi search history previous
+ * [?]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_search_prev(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return (cv_search(el, ED_SEARCH_PREV_HISTORY));
+}
+
+
+/* vi_search_next():
+ * Vi search history next
+ * [/]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_search_next(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return (cv_search(el, ED_SEARCH_NEXT_HISTORY));
+}
+
+
+/* vi_repeat_search_next():
+ * Vi repeat current search in the same search direction
+ * [n]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_repeat_search_next(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_search.patlen == 0)
+ return (CC_ERROR);
+ else
+ return (cv_repeat_srch(el, el->el_search.patdir));
+}
+
+
+/* vi_repeat_search_prev():
+ * Vi repeat current search in the opposite search direction
+ * [N]
+ */
+/*ARGSUSED*/
+protected el_action_t
+vi_repeat_search_prev(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ if (el->el_search.patlen == 0)
+ return (CC_ERROR);
+ else
+ return (cv_repeat_srch(el,
+ el->el_search.patdir == ED_SEARCH_PREV_HISTORY ?
+ ED_SEARCH_NEXT_HISTORY : ED_SEARCH_PREV_HISTORY));
+}
+
+
+/* vi_next_char():
+ * Vi move to the character specified next
+ * [f]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_next_char(EditLine *el, int c __attribute__((__unused__)))
+{
+ return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 0);
+}
+
+
+/* vi_prev_char():
+ * Vi move to the character specified previous
+ * [F]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+ return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 0);
+}
+
+
+/* vi_to_next_char():
+ * Vi move up to the character specified next
+ * [t]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_to_next_char(EditLine *el, int c __attribute__((__unused__)))
+{
+ return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 1);
+}
+
+
+/* vi_to_prev_char():
+ * Vi move up to the character specified previous
+ * [T]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_to_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+ return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 1);
+}
+
+
+/* vi_repeat_next_char():
+ * Vi repeat current character search in the same search direction
+ * [;]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_repeat_next_char(EditLine *el, int c __attribute__((__unused__)))
+{
+
+ return cv_csearch(el, el->el_search.chadir, el->el_search.chacha,
+ el->el_state.argument, el->el_search.chatflg);
+}
+
+
+/* vi_repeat_prev_char():
+ * Vi repeat current character search in the opposite search direction
+ * [,]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_repeat_prev_char(EditLine *el, int c __attribute__((__unused__)))
+{
+ el_action_t r;
+ int dir = el->el_search.chadir;
+
+ r = cv_csearch(el, -dir, el->el_search.chacha,
+ el->el_state.argument, el->el_search.chatflg);
+ el->el_search.chadir = dir;
+ return r;
+}
+
+
+/* vi_match():
+ * Vi go to matching () {} or []
+ * [%]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_match(EditLine *el, int c)
+{
+ const char match_chars[] = "()[]{}";
+ char *cp;
+ int delta, i, count;
+ char o_ch, c_ch;
+
+ *el->el_line.lastchar = '\0'; /* just in case */
+
+ i = strcspn(el->el_line.cursor, match_chars);
+ o_ch = el->el_line.cursor[i];
+ if (o_ch == 0)
+ return CC_ERROR;
+ delta = strchr(match_chars, o_ch) - match_chars;
+ c_ch = match_chars[delta ^ 1];
+ count = 1;
+ delta = 1 - (delta & 1) * 2;
+
+ for (cp = &el->el_line.cursor[i]; count; ) {
+ cp += delta;
+ if (cp < el->el_line.buffer || cp >= el->el_line.lastchar)
+ return CC_ERROR;
+ if (*cp == o_ch)
+ count++;
+ else if (*cp == c_ch)
+ count--;
+ }
+
+ el->el_line.cursor = cp;
+
+ if (el->el_chared.c_vcmd.action != NOP) {
+ /* NB posix says char under cursor should NOT be deleted
+ for -ve delta - this is different to netbsd vi. */
+ if (delta > 0)
+ el->el_line.cursor++;
+ cv_delfini(el);
+ return (CC_REFRESH);
+ }
+ return (CC_CURSOR);
+}
+
+/* vi_undo_line():
+ * Vi undo all changes to line
+ * [U]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_undo_line(EditLine *el, int c)
+{
+
+ cv_undo(el);
+ return hist_get(el);
+}
+
+/* vi_to_column():
+ * Vi go to specified column
+ * [|]
+ * NB netbsd vi goes to screen column 'n', posix says nth character
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_to_column(EditLine *el, int c)
+{
+
+ el->el_line.cursor = el->el_line.buffer;
+ el->el_state.argument--;
+ return ed_next_char(el, 0);
+}
+
+/* vi_yank_end():
+ * Vi yank to end of line
+ * [Y]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_yank_end(EditLine *el, int c)
+{
+
+ cv_yank(el, el->el_line.cursor,
+ el->el_line.lastchar - el->el_line.cursor);
+ return CC_REFRESH;
+}
+
+/* vi_yank():
+ * Vi yank
+ * [y]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_yank(EditLine *el, int c)
+{
+
+ return cv_action(el, YANK);
+}
+
+/* vi_comment_out():
+ * Vi comment out current command
+ * [#]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_comment_out(EditLine *el, int c)
+{
+
+ el->el_line.cursor = el->el_line.buffer;
+ c_insert(el, 1);
+ *el->el_line.cursor = '#';
+ re_refresh(el);
+ return ed_newline(el, 0);
+}
+
+/* vi_alias():
+ * Vi include shell alias
+ * [@]
+ * NB: posix implies that we should enter insert mode, however
+ * this is against historical precedent...
+ */
+#ifdef __weak_reference
+extern char *get_alias_text(const char *) __weak_reference(get_alias_text);
+#endif
+protected el_action_t
+/*ARGSUSED*/
+vi_alias(EditLine *el, int c)
+{
+#ifdef __weak_reference
+ char alias_name[3];
+ char *alias_text;
+
+ if (get_alias_text == 0) {
+ return CC_ERROR;
+ }
+
+ alias_name[0] = '_';
+ alias_name[2] = 0;
+ if (el_getc(el, &alias_name[1]) != 1)
+ return CC_ERROR;
+
+ alias_text = get_alias_text(alias_name);
+ if (alias_text != NULL)
+ el_push(el, alias_text);
+ return CC_NORM;
+#else
+ return CC_ERROR;
+#endif
+}
+
+/* vi_to_history_line():
+ * Vi go to specified history file line.
+ * [G]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_to_history_line(EditLine *el, int c)
+{
+ int sv_event_no = el->el_history.eventno;
+ el_action_t rval;
+
+
+ if (el->el_history.eventno == 0) {
+ (void) strncpy(el->el_history.buf, el->el_line.buffer,
+ EL_BUFSIZ);
+ el->el_history.last = el->el_history.buf +
+ (el->el_line.lastchar - el->el_line.buffer);
+ }
+
+ /* Lack of a 'count' means oldest, not 1 */
+ if (!el->el_state.doingarg) {
+ el->el_history.eventno = 0x7fffffff;
+ hist_get(el);
+ } else {
+ /* This is brain dead, all the rest of this code counts
+ * upwards going into the past. Here we need count in the
+ * other direction (to match the output of fc -l).
+ * I could change the world, but this seems to suffice.
+ */
+ el->el_history.eventno = 1;
+ if (hist_get(el) == CC_ERROR)
+ return CC_ERROR;
+ el->el_history.eventno = 1 + el->el_history.ev.num
+ - el->el_state.argument;
+ if (el->el_history.eventno < 0) {
+ el->el_history.eventno = sv_event_no;
+ return CC_ERROR;
+ }
+ }
+ rval = hist_get(el);
+ if (rval == CC_ERROR)
+ el->el_history.eventno = sv_event_no;
+ return rval;
+}
+
+/* vi_histedit():
+ * Vi edit history line with vi
+ * [v]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_histedit(EditLine *el, int c)
+{
+ int fd;
+ pid_t pid;
+ int st;
+ char tempfile[] = "/tmp/histedit.XXXXXXXXXX";
+ char *cp;
+
+ if (el->el_state.doingarg) {
+ if (vi_to_history_line(el, 0) == CC_ERROR)
+ return CC_ERROR;
+ }
+
+ fd = mkstemp(tempfile);
+ if (fd < 0)
+ return CC_ERROR;
+ cp = el->el_line.buffer;
+ write(fd, cp, el->el_line.lastchar - cp +0u);
+ write(fd, "\n", 1);
+ pid = fork();
+ switch (pid) {
+ case -1:
+ close(fd);
+ unlink(tempfile);
+ return CC_ERROR;
+ case 0:
+ close(fd);
+ execlp("vi", "vi", tempfile, NULL);
+ exit(0);
+ /*NOTREACHED*/
+ default:
+ while (waitpid(pid, &st, 0) != pid)
+ continue;
+ lseek(fd, 0ll, SEEK_SET);
+ st = read(fd, cp, el->el_line.limit - cp +0u);
+ if (st > 0 && cp[st - 1] == '\n')
+ st--;
+ el->el_line.cursor = cp;
+ el->el_line.lastchar = cp + st;
+ break;
+ }
+
+ close(fd);
+ unlink(tempfile);
+ /* return CC_REFRESH; */
+ return ed_newline(el, 0);
+}
+
+/* vi_history_word():
+ * Vi append word from previous input line
+ * [_]
+ * Who knows where this one came from!
+ * '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_'
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_history_word(EditLine *el, int c)
+{
+ const char *wp = HIST_FIRST(el);
+ const char *wep, *wsp;
+ int len;
+ char *cp;
+ const char *lim;
+
+ if (wp == NULL)
+ return CC_ERROR;
+
+ wep = wsp = 0;
+ do {
+ while (isspace((unsigned char)*wp))
+ wp++;
+ if (*wp == 0)
+ break;
+ wsp = wp;
+ while (*wp && !isspace((unsigned char)*wp))
+ wp++;
+ wep = wp;
+ } while ((!el->el_state.doingarg || --el->el_state.argument > 0) && *wp != 0);
+
+ if (wsp == 0 || (el->el_state.doingarg && el->el_state.argument != 0))
+ return CC_ERROR;
+
+ cv_undo(el);
+ len = wep - wsp;
+ if (el->el_line.cursor < el->el_line.lastchar)
+ el->el_line.cursor++;
+ c_insert(el, len + 1);
+ cp = el->el_line.cursor;
+ lim = el->el_line.limit;
+ if (cp < lim)
+ *cp++ = ' ';
+ while (wsp < wep && cp < lim)
+ *cp++ = *wsp++;
+ el->el_line.cursor = cp;
+
+ el->el_map.current = el->el_map.key;
+ return CC_REFRESH;
+}
+
+/* vi_redo():
+ * Vi redo last non-motion command
+ * [.]
+ */
+protected el_action_t
+/*ARGSUSED*/
+vi_redo(EditLine *el, int c)
+{
+ c_redo_t *r = &el->el_chared.c_redo;
+
+ if (!el->el_state.doingarg && r->count) {
+ el->el_state.doingarg = 1;
+ el->el_state.argument = r->count;
+ }
+
+ el->el_chared.c_vcmd.pos = el->el_line.cursor;
+ el->el_chared.c_vcmd.action = r->action;
+ if (r->pos != r->buf) {
+ if (r->pos + 1 > r->lim)
+ /* sanity */
+ r->pos = r->lim - 1;
+ r->pos[0] = 0;
+ el_push(el, r->buf);
+ }
+
+ el->el_state.thiscmd = r->cmd;
+ el->el_state.thisch = r->ch;
+ return (*el->el_map.func[r->cmd])(el, r->ch);
+}
diff --git a/frontend/libedit/vi.h b/frontend/libedit/vi.h
new file mode 100644
index 0000000..fec33b4
--- /dev/null
+++ b/frontend/libedit/vi.h
@@ -0,0 +1,51 @@
+/* Automatically generated file, do not edit */
+#ifndef _h_vi_c
+#define _h_vi_c
+protected el_action_t vi_paste_next (EditLine *, int);
+protected el_action_t vi_paste_prev (EditLine *, int);
+protected el_action_t vi_prev_big_word (EditLine *, int);
+protected el_action_t vi_prev_word (EditLine *, int);
+protected el_action_t vi_next_big_word (EditLine *, int);
+protected el_action_t vi_next_word (EditLine *, int);
+protected el_action_t vi_change_case (EditLine *, int);
+protected el_action_t vi_change_meta (EditLine *, int);
+protected el_action_t vi_insert_at_bol (EditLine *, int);
+protected el_action_t vi_replace_char (EditLine *, int);
+protected el_action_t vi_replace_mode (EditLine *, int);
+protected el_action_t vi_substitute_char (EditLine *, int);
+protected el_action_t vi_substitute_line (EditLine *, int);
+protected el_action_t vi_change_to_eol (EditLine *, int);
+protected el_action_t vi_insert (EditLine *, int);
+protected el_action_t vi_add (EditLine *, int);
+protected el_action_t vi_add_at_eol (EditLine *, int);
+protected el_action_t vi_delete_meta (EditLine *, int);
+protected el_action_t vi_end_big_word (EditLine *, int);
+protected el_action_t vi_end_word (EditLine *, int);
+protected el_action_t vi_undo (EditLine *, int);
+protected el_action_t vi_command_mode (EditLine *, int);
+protected el_action_t vi_zero (EditLine *, int);
+protected el_action_t vi_delete_prev_char (EditLine *, int);
+protected el_action_t vi_list_or_eof (EditLine *, int);
+protected el_action_t vi_kill_line_prev (EditLine *, int);
+protected el_action_t vi_search_prev (EditLine *, int);
+protected el_action_t vi_search_next (EditLine *, int);
+protected el_action_t vi_repeat_search_next (EditLine *, int);
+protected el_action_t vi_repeat_search_prev (EditLine *, int);
+protected el_action_t vi_next_char (EditLine *, int);
+protected el_action_t vi_prev_char (EditLine *, int);
+protected el_action_t vi_to_next_char (EditLine *, int);
+protected el_action_t vi_to_prev_char (EditLine *, int);
+protected el_action_t vi_repeat_next_char (EditLine *, int);
+protected el_action_t vi_repeat_prev_char (EditLine *, int);
+protected el_action_t vi_match (EditLine *, int);
+protected el_action_t vi_undo_line (EditLine *, int);
+protected el_action_t vi_to_column (EditLine *, int);
+protected el_action_t vi_yank_end (EditLine *, int);
+protected el_action_t vi_yank (EditLine *, int);
+protected el_action_t vi_comment_out (EditLine *, int);
+protected el_action_t vi_alias (EditLine *, int);
+protected el_action_t vi_to_history_line (EditLine *, int);
+protected el_action_t vi_histedit (EditLine *, int);
+protected el_action_t vi_history_word (EditLine *, int);
+protected el_action_t vi_redo (EditLine *, int);
+#endif /* _h_vi_c */
diff --git a/frontend/libedit/vis.c b/frontend/libedit/vis.c
new file mode 100644
index 0000000..f864462
--- /dev/null
+++ b/frontend/libedit/vis.c
@@ -0,0 +1,404 @@
+/* $NetBSD: vis.c,v 1.35 2006/08/28 20:42:12 christos Exp $ */
+
+/*-
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 1999, 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* AIX requires this to be the first thing in the file. */
+#if defined (_AIX) && !defined (__GNUC__)
+ #pragma alloca
+#endif
+
+#include <config.h>
+
+#ifdef __GNUC__
+# undef alloca
+# define alloca(n) __builtin_alloca (n)
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifndef _AIX
+extern char *alloca ();
+# endif
+# endif
+#endif
+
+#include <sys/types.h>
+
+#include <assert.h>
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(x) assert(x)
+#endif
+#include <vis.h>
+#include <stdlib.h>
+
+#ifdef __weak_alias
+__weak_alias(strsvis,_strsvis)
+__weak_alias(strsvisx,_strsvisx)
+__weak_alias(strvis,_strvis)
+__weak_alias(strvisx,_strvisx)
+__weak_alias(svis,_svis)
+__weak_alias(vis,_vis)
+#endif
+
+#if !HAVE_VIS || !HAVE_SVIS
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+
+#undef BELL
+#define BELL '\a'
+
+#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
+#define iswhite(c) (c == ' ' || c == '\t' || c == '\n')
+#define issafe(c) (c == '\b' || c == BELL || c == '\r')
+#define xtoa(c) "0123456789abcdef"[c]
+
+#define MAXEXTRAS 5
+
+
+#define MAKEEXTRALIST(flag, extra, orig_str) \
+do { \
+ const char *orig = orig_str; \
+ const char *o = orig; \
+ char *e; \
+ while (*o++) \
+ continue; \
+ extra = malloc((size_t)((o - orig) + MAXEXTRAS)); \
+ if (!extra) break; \
+ for (o = orig, e = extra; (*e++ = *o++) != '\0';) \
+ continue; \
+ e--; \
+ if (flag & VIS_SP) *e++ = ' '; \
+ if (flag & VIS_TAB) *e++ = '\t'; \
+ if (flag & VIS_NL) *e++ = '\n'; \
+ if ((flag & VIS_NOSLASH) == 0) *e++ = '\\'; \
+ *e = '\0'; \
+} while (/*CONSTCOND*/0)
+
+
+/*
+ * This is HVIS, the macro of vis used to HTTP style (RFC 1808)
+ */
+#define HVIS(dst, c, flag, nextc, extra) \
+do \
+ if (!isascii(c) || !isalnum(c) || strchr("$-_.+!*'(),", c) != NULL) { \
+ *dst++ = '%'; \
+ *dst++ = xtoa(((unsigned int)c >> 4) & 0xf); \
+ *dst++ = xtoa((unsigned int)c & 0xf); \
+ } else { \
+ SVIS(dst, c, flag, nextc, extra); \
+ } \
+while (/*CONSTCOND*/0)
+
+/*
+ * This is SVIS, the central macro of vis.
+ * dst: Pointer to the destination buffer
+ * c: Character to encode
+ * flag: Flag word
+ * nextc: The character following 'c'
+ * extra: Pointer to the list of extra characters to be
+ * backslash-protected.
+ */
+#define SVIS(dst, c, flag, nextc, extra) \
+do { \
+ int isextra; \
+ isextra = strchr(extra, c) != NULL; \
+ if (!isextra && isascii(c) && (isgraph(c) || iswhite(c) || \
+ ((flag & VIS_SAFE) && issafe(c)))) { \
+ *dst++ = c; \
+ break; \
+ } \
+ if (flag & VIS_CSTYLE) { \
+ switch (c) { \
+ case '\n': \
+ *dst++ = '\\'; *dst++ = 'n'; \
+ continue; \
+ case '\r': \
+ *dst++ = '\\'; *dst++ = 'r'; \
+ continue; \
+ case '\b': \
+ *dst++ = '\\'; *dst++ = 'b'; \
+ continue; \
+ case BELL: \
+ *dst++ = '\\'; *dst++ = 'a'; \
+ continue; \
+ case '\v': \
+ *dst++ = '\\'; *dst++ = 'v'; \
+ continue; \
+ case '\t': \
+ *dst++ = '\\'; *dst++ = 't'; \
+ continue; \
+ case '\f': \
+ *dst++ = '\\'; *dst++ = 'f'; \
+ continue; \
+ case ' ': \
+ *dst++ = '\\'; *dst++ = 's'; \
+ continue; \
+ case '\0': \
+ *dst++ = '\\'; *dst++ = '0'; \
+ if (isoctal(nextc)) { \
+ *dst++ = '0'; \
+ *dst++ = '0'; \
+ } \
+ continue; \
+ default: \
+ if (isgraph(c)) { \
+ *dst++ = '\\'; *dst++ = c; \
+ continue; \
+ } \
+ } \
+ } \
+ if (isextra || ((c & 0177) == ' ') || (flag & VIS_OCTAL)) { \
+ *dst++ = '\\'; \
+ *dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + '0'; \
+ *dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + '0'; \
+ *dst++ = (c & 07) + '0'; \
+ } else { \
+ if ((flag & VIS_NOSLASH) == 0) *dst++ = '\\'; \
+ if (c & 0200) { \
+ c &= 0177; *dst++ = 'M'; \
+ } \
+ if (iscntrl(c)) { \
+ *dst++ = '^'; \
+ if (c == 0177) \
+ *dst++ = '?'; \
+ else \
+ *dst++ = c + '@'; \
+ } else { \
+ *dst++ = '-'; *dst++ = c; \
+ } \
+ } \
+} while (/*CONSTCOND*/0)
+
+
+/*
+ * svis - visually encode characters, also encoding the characters
+ * pointed to by `extra'
+ */
+char *
+svis(char *dst, int c, int flag, int nextc, const char *extra)
+{
+ char *nextra = NULL;
+
+ _DIAGASSERT(dst != NULL);
+ _DIAGASSERT(extra != NULL);
+ MAKEEXTRALIST(flag, nextra, extra);
+ if (!nextra) {
+ *dst = '\0'; /* can't create nextra, return "" */
+ return dst;
+ }
+ if (flag & VIS_HTTPSTYLE)
+ HVIS(dst, c, flag, nextc, nextra);
+ else
+ SVIS(dst, c, flag, nextc, nextra);
+ free(nextra);
+ *dst = '\0';
+ return dst;
+}
+
+
+/*
+ * strsvis, strsvisx - visually encode characters from src into dst
+ *
+ * Extra is a pointer to a \0-terminated list of characters to
+ * be encoded, too. These functions are useful e. g. to
+ * encode strings in such a way so that they are not interpreted
+ * by a shell.
+ *
+ * Dst must be 4 times the size of src to account for possible
+ * expansion. The length of dst, not including the trailing NULL,
+ * is returned.
+ *
+ * Strsvisx encodes exactly len bytes from src into dst.
+ * This is useful for encoding a block of data.
+ */
+int
+strsvis(char *dst, const char *csrc, int flag, const char *extra)
+{
+ int c;
+ char *start;
+ char *nextra = NULL;
+ const unsigned char *src = (const unsigned char *)csrc;
+
+ _DIAGASSERT(dst != NULL);
+ _DIAGASSERT(src != NULL);
+ _DIAGASSERT(extra != NULL);
+ MAKEEXTRALIST(flag, nextra, extra);
+ if (!nextra) {
+ *dst = '\0'; /* can't create nextra, return "" */
+ return 0;
+ }
+ if (flag & VIS_HTTPSTYLE) {
+ for (start = dst; (c = *src++) != '\0'; /* empty */)
+ HVIS(dst, c, flag, *src, nextra);
+ } else {
+ for (start = dst; (c = *src++) != '\0'; /* empty */)
+ SVIS(dst, c, flag, *src, nextra);
+ }
+ free(nextra);
+ *dst = '\0';
+ return (dst - start);
+}
+
+
+int
+strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra)
+{
+ unsigned char c;
+ char *start;
+ char *nextra = NULL;
+ const unsigned char *src = (const unsigned char *)csrc;
+
+ _DIAGASSERT(dst != NULL);
+ _DIAGASSERT(src != NULL);
+ _DIAGASSERT(extra != NULL);
+ MAKEEXTRALIST(flag, nextra, extra);
+ if (! nextra) {
+ *dst = '\0'; /* can't create nextra, return "" */
+ return 0;
+ }
+
+ if (flag & VIS_HTTPSTYLE) {
+ for (start = dst; len > 0; len--) {
+ c = *src++;
+ HVIS(dst, c, flag, len ? *src : '\0', nextra);
+ }
+ } else {
+ for (start = dst; len > 0; len--) {
+ c = *src++;
+ SVIS(dst, c, flag, len ? *src : '\0', nextra);
+ }
+ }
+ free(nextra);
+ *dst = '\0';
+ return (dst - start);
+}
+#endif
+
+#if !HAVE_VIS
+/*
+ * vis - visually encode characters
+ */
+char *
+vis(char *dst, int c, int flag, int nextc)
+{
+ char *extra = NULL;
+ unsigned char uc = (unsigned char)c;
+
+ _DIAGASSERT(dst != NULL);
+
+ MAKEEXTRALIST(flag, extra, "");
+ if (! extra) {
+ *dst = '\0'; /* can't create extra, return "" */
+ return dst;
+ }
+ if (flag & VIS_HTTPSTYLE)
+ HVIS(dst, uc, flag, nextc, extra);
+ else
+ SVIS(dst, uc, flag, nextc, extra);
+ free(extra);
+ *dst = '\0';
+ return dst;
+}
+
+
+/*
+ * strvis, strvisx - visually encode characters from src into dst
+ *
+ * Dst must be 4 times the size of src to account for possible
+ * expansion. The length of dst, not including the trailing NULL,
+ * is returned.
+ *
+ * Strvisx encodes exactly len bytes from src into dst.
+ * This is useful for encoding a block of data.
+ */
+int
+strvis(char *dst, const char *src, int flag)
+{
+ char *extra = NULL;
+ int rv;
+
+ MAKEEXTRALIST(flag, extra, "");
+ if (!extra) {
+ *dst = '\0'; /* can't create extra, return "" */
+ return 0;
+ }
+ rv = strsvis(dst, src, flag, extra);
+ free(extra);
+ return rv;
+}
+
+
+int
+strvisx(char *dst, const char *src, size_t len, int flag)
+{
+ char *extra = NULL;
+ int rv;
+
+ MAKEEXTRALIST(flag, extra, "");
+ if (!extra) {
+ *dst = '\0'; /* can't create extra, return "" */
+ return 0;
+ }
+ rv = strsvisx(dst, src, len, flag, extra);
+ free(extra);
+ return rv;
+}
+#endif
diff --git a/frontend/libedit/vis.h b/frontend/libedit/vis.h
new file mode 100644
index 0000000..7baba2d
--- /dev/null
+++ b/frontend/libedit/vis.h
@@ -0,0 +1,89 @@
+/* $NetBSD: vis.h,v 1.16 2005/09/13 01:44:32 christos Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)vis.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _VIS_H_
+#define _VIS_H_
+
+#include <config.h>
+
+/*
+ * to select alternate encoding format
+ */
+#define VIS_OCTAL 0x01 /* use octal \ddd format */
+#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropiate */
+
+/*
+ * to alter set of characters encoded (default is to encode all
+ * non-graphic except space, tab, and newline).
+ */
+#define VIS_SP 0x04 /* also encode space */
+#define VIS_TAB 0x08 /* also encode tab */
+#define VIS_NL 0x10 /* also encode newline */
+#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
+#define VIS_SAFE 0x20 /* only encode "unsafe" characters */
+
+/*
+ * other
+ */
+#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
+#define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */
+
+/*
+ * unvis return codes
+ */
+#define UNVIS_VALID 1 /* character valid */
+#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */
+#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */
+#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */
+#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */
+
+/*
+ * unvis flags
+ */
+#define UNVIS_END 1 /* no more characters */
+
+__BEGIN_DECLS
+char *vis(char *, int, int, int);
+char *svis(char *, int, int, int, const char *);
+int strvis(char *, const char *, int);
+int strsvis(char *, const char *, int, const char *);
+int strvisx(char *, const char *, size_t, int);
+int strsvisx(char *, const char *, size_t, int, const char *);
+int strunvis(char *, const char *);
+int strunvisx(char *, const char *, int);
+#ifndef __LIBC12_SOURCE__
+int unvis(char *, int, int *, int);
+#endif
+__END_DECLS
+
+#endif /* !_VIS_H_ */
diff --git a/interface/Makefile.in b/interface/Makefile.in
index be0e73b..46bbd29 100644
--- a/interface/Makefile.in
+++ b/interface/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/languages/Language.cs b/languages/Language.cs
index 3f4d8bd..d24ac7d 100644
--- a/languages/Language.cs
+++ b/languages/Language.cs
@@ -13,7 +13,7 @@ namespace Mono.Debugger.Languages
get;
}
- internal abstract Process Process {
+ internal abstract ProcessServant Process {
get;
}
diff --git a/languages/Makefile.in b/languages/Makefile.in
index f748388..24fe936 100644
--- a/languages/Makefile.in
+++ b/languages/Makefile.in
@@ -129,6 +129,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/languages/mono/Makefile.in b/languages/mono/Makefile.in
index 96e994b..cec3cac 100644
--- a/languages/mono/Makefile.in
+++ b/languages/mono/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/languages/mono/MonoClassInfo.cs b/languages/mono/MonoClassInfo.cs
index 41d614c..c1238cc 100644
--- a/languages/mono/MonoClassInfo.cs
+++ b/languages/mono/MonoClassInfo.cs
@@ -42,8 +42,8 @@ namespace Mono.Debugger.Languages.Mono
throw new InternalError ();
Cecil.TypeDefinition typedef;
- typedef = (Cecil.TypeDefinition) file.ModuleDefinition.LookupToken (
- new Cecil.MetadataToken (Cecil.TokenType.TypeDef, token & 0x00ffffff));
+ typedef = (Cecil.TypeDefinition) file.ModuleDefinition.LookupByToken (
+ Cecil.Metadata.TokenType.TypeDef, token & 0x00ffffff);
if (typedef == null)
throw new InternalError ();
diff --git a/languages/mono/MonoClassType.cs b/languages/mono/MonoClassType.cs
index db1606e..847fa5a 100644
--- a/languages/mono/MonoClassType.cs
+++ b/languages/mono/MonoClassType.cs
@@ -204,7 +204,7 @@ namespace Mono.Debugger.Languages.Mono
return class_info;
if (class_info == null) {
- int token = type.MetadataToken.ToInt32 ();
+ int token = (int) type.MetadataToken.ToUInt ();
class_info = file.LookupClassInfo (target, token);
}
diff --git a/languages/mono/MonoDebuggerSupport.cs b/languages/mono/MonoDebuggerSupport.cs
index f16404e..f2cb252 100644
--- a/languages/mono/MonoDebuggerSupport.cs
+++ b/languages/mono/MonoDebuggerSupport.cs
@@ -11,13 +11,13 @@ namespace Mono.Debugger.Languages.Mono
{
public static int GetMethodToken (Cecil.MethodDefinition method)
{
- return method.MetadataToken.ToInt32 ();
+ return (int) (method.MetadataToken.TokenType + method.MetadataToken.RID);
}
public static Cecil.MethodDefinition GetMethod (Cecil.ModuleDefinition module, int token)
{
- return (Cecil.MethodDefinition) module.LookupToken (
- new Cecil.MetadataToken (Cecil.TokenType.Method, token & 0xffffff));
+ return (Cecil.MethodDefinition) module.LookupByToken (
+ Cecil.Metadata.TokenType.Method, token & 0xffffff);
}
}
}
diff --git a/languages/mono/MonoFunctionType.cs b/languages/mono/MonoFunctionType.cs
index 9457313..a82170b 100644
--- a/languages/mono/MonoFunctionType.cs
+++ b/languages/mono/MonoFunctionType.cs
@@ -34,7 +34,7 @@ namespace Mono.Debugger.Languages.Mono
rtype = mdef.DeclaringType;
has_return_type = true;
} else {
- rtype = mdef.ReturnType;
+ rtype = mdef.ReturnType.ReturnType;
has_return_type = rtype.FullName != "System.Void";
}
return_type = klass.File.MonoLanguage.LookupMonoType (rtype);
@@ -52,7 +52,7 @@ namespace Mono.Debugger.Languages.Mono
internal static string GetMethodName (Cecil.MethodDefinition mdef)
{
- var gen_params = mdef.GenericParameters;
+ Cecil.GenericParameterCollection gen_params = mdef.GenericParameters;
if ((gen_params == null) || (gen_params.Count == 0))
return mdef.Name;
else
diff --git a/languages/mono/MonoFundamentalType.cs b/languages/mono/MonoFundamentalType.cs
index 10962d7..1e9b009 100644
--- a/languages/mono/MonoFundamentalType.cs
+++ b/languages/mono/MonoFundamentalType.cs
@@ -31,104 +31,104 @@ namespace Mono.Debugger.Languages.Mono
case FundamentalKind.Boolean:
klass = corlib.MonoLanguage.MetadataHelper.GetBooleanClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Boolean"),
+ corlib, corlib.ModuleDefinition.Types ["System.Boolean"],
"bool", kind, 1);
break;
case FundamentalKind.Char:
klass = corlib.MonoLanguage.MetadataHelper.GetCharClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Char"),
+ corlib, corlib.ModuleDefinition.Types ["System.Char"],
"char", kind, 2);
break;
case FundamentalKind.SByte:
klass = corlib.MonoLanguage.MetadataHelper.GetSByteClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.SByte"),
+ corlib, corlib.ModuleDefinition.Types ["System.SByte"],
"sbyte", kind, 1);
break;
case FundamentalKind.Byte:
klass = corlib.MonoLanguage.MetadataHelper.GetByteClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Byte"),
+ corlib, corlib.ModuleDefinition.Types ["System.Byte"],
"byte", kind, 1);
break;
case FundamentalKind.Int16:
klass = corlib.MonoLanguage.MetadataHelper.GetInt16Class (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Int16"),
+ corlib, corlib.ModuleDefinition.Types ["System.Int16"],
"short", kind, 2);
break;
case FundamentalKind.UInt16:
klass = corlib.MonoLanguage.MetadataHelper.GetUInt16Class (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.UInt16"),
+ corlib, corlib.ModuleDefinition.Types ["System.UInt16"],
"ushort", kind, 2);
break;
case FundamentalKind.Int32:
klass = corlib.MonoLanguage.MetadataHelper.GetInt32Class (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Int32"),
+ corlib, corlib.ModuleDefinition.Types ["System.Int32"],
"int", kind, 4);
break;
case FundamentalKind.UInt32:
klass = corlib.MonoLanguage.MetadataHelper.GetUInt32Class (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.UInt32"),
+ corlib, corlib.ModuleDefinition.Types ["System.UInt32"],
"uint", kind, 4);
break;
case FundamentalKind.Int64:
klass = corlib.MonoLanguage.MetadataHelper.GetInt64Class (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Int64"),
+ corlib, corlib.ModuleDefinition.Types ["System.Int64"],
"long", kind, 8);
break;
case FundamentalKind.UInt64:
klass = corlib.MonoLanguage.MetadataHelper.GetUInt64Class (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.UInt64"),
+ corlib, corlib.ModuleDefinition.Types ["System.UInt64"],
"ulong", kind, 8);
break;
case FundamentalKind.Single:
klass = corlib.MonoLanguage.MetadataHelper.GetSingleClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Single"),
+ corlib, corlib.ModuleDefinition.Types ["System.Single"],
"float", kind, 4);
break;
case FundamentalKind.Double:
klass = corlib.MonoLanguage.MetadataHelper.GetDoubleClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Double"),
+ corlib, corlib.ModuleDefinition.Types ["System.Double"],
"double", kind, 8);
break;
case FundamentalKind.IntPtr:
klass = corlib.MonoLanguage.MetadataHelper.GetIntPtrClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.IntPtr"),
+ corlib, corlib.ModuleDefinition.Types ["System.IntPtr"],
"System.IntPtr", kind, memory.TargetMemoryInfo.TargetAddressSize);
break;
case FundamentalKind.UIntPtr:
klass = corlib.MonoLanguage.MetadataHelper.GetUIntPtrClass (memory);
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.UIntPtr"),
+ corlib, corlib.ModuleDefinition.Types ["System.UIntPtr"],
"System.UIntPtr", kind, memory.TargetMemoryInfo.TargetAddressSize);
break;
case FundamentalKind.Decimal:
fundamental = new MonoFundamentalType (
- corlib, corlib.ModuleDefinition.GetType ("System.Decimal"),
+ corlib, corlib.ModuleDefinition.Types ["System.Decimal"],
"decimal", kind, Marshal.SizeOf (typeof (Decimal)));
return fundamental;
diff --git a/languages/mono/MonoMember.cs b/languages/mono/MonoMember.cs
index 8695654..958d7fc 100644
--- a/languages/mono/MonoMember.cs
+++ b/languages/mono/MonoMember.cs
@@ -124,7 +124,7 @@ namespace Mono.Debugger.Languages.Mono
case Cecil.MethodAttributes.Family:
case Cecil.MethodAttributes.FamANDAssem:
return TargetMemberAccessibility.Protected;
- case Cecil.MethodAttributes.Assembly:
+ case Cecil.MethodAttributes.Assem:
case Cecil.MethodAttributes.FamORAssem:
return TargetMemberAccessibility.Internal;
default:
diff --git a/languages/mono/MonoObjectType.cs b/languages/mono/MonoObjectType.cs
index 017bbec..94ab2da 100644
--- a/languages/mono/MonoObjectType.cs
+++ b/languages/mono/MonoObjectType.cs
@@ -28,7 +28,7 @@ namespace Mono.Debugger.Languages.Mono
int object_size = 2 * memory.TargetMemoryInfo.TargetAddressSize;
MonoObjectType type = new MonoObjectType (
- corlib, corlib.ModuleDefinition.GetType ("System.Object"),
+ corlib, corlib.ModuleDefinition.Types ["System.Object"],
object_size);
TargetAddress klass = corlib.MonoLanguage.MetadataHelper.GetObjectClass (memory);
diff --git a/languages/mono/MonoStringType.cs b/languages/mono/MonoStringType.cs
index 43523be..98f6b0b 100644
--- a/languages/mono/MonoStringType.cs
+++ b/languages/mono/MonoStringType.cs
@@ -26,7 +26,7 @@ namespace Mono.Debugger.Languages.Mono
int object_size = 2 * memory.TargetMemoryInfo.TargetAddressSize;
MonoStringType type = new MonoStringType (
- corlib, corlib.ModuleDefinition.GetType ("System.String"),
+ corlib, corlib.ModuleDefinition.Types ["System.String"],
object_size, object_size + 4);
TargetAddress klass = corlib.MonoLanguage.MetadataHelper.GetStringClass (memory);
diff --git a/languages/mono/MonoStructType.cs b/languages/mono/MonoStructType.cs
index bf1f717..8703bf4 100644
--- a/languages/mono/MonoStructType.cs
+++ b/languages/mono/MonoStructType.cs
@@ -115,8 +115,13 @@ namespace Mono.Debugger.Languages.Mono
function_hash.Add (method, func);
}
+ foreach (Cecil.MethodDefinition method in TypeDef.Constructors) {
+ MonoFunctionType func = new MonoFunctionType (this, method);
+ function_hash.Add (method, func);
+ }
+
int num_methods = 0;
- foreach (Cecil.MethodDefinition method in GetMethods (TypeDef, false)) {
+ foreach (Cecil.MethodDefinition method in TypeDef.Methods) {
if ((method.Attributes & Cecil.MethodAttributes.SpecialName) != 0)
continue;
num_methods++;
@@ -125,7 +130,7 @@ namespace Mono.Debugger.Languages.Mono
methods = new MonoMethodInfo [num_methods];
int pos = 0;
- foreach (Cecil.MethodDefinition method in GetMethods (TypeDef, false)) {
+ foreach (Cecil.MethodDefinition method in TypeDef.Methods) {
if ((method.Attributes & Cecil.MethodAttributes.SpecialName) != 0)
continue;
methods [pos] = MonoMethodInfo.Create (this, pos, method);
@@ -134,27 +139,16 @@ namespace Mono.Debugger.Languages.Mono
}
}
- static IEnumerable<Cecil.MethodDefinition> GetMethods (Cecil.TypeDefinition type, bool constructor)
- {
- foreach (var method in type.Methods) {
- if (constructor && method.IsConstructor)
- yield return method;
-
- if (!constructor && !method.IsConstructor)
- yield return method;
- }
- }
-
void get_constructors ()
{
lock (this) {
if (constructors != null)
return;
- var ctors = new List<Cecil.MethodDefinition> (GetMethods (TypeDef, true));
+ constructors = new MonoMethodInfo [TypeDef.Constructors.Count];
- for (int i = 0; i < ctors.Count; i++) {
- Cecil.MethodDefinition method = ctors [i];
+ for (int i = 0; i < constructors.Length; i++) {
+ Cecil.MethodDefinition method = TypeDef.Constructors [i];
constructors [i] = MonoMethodInfo.Create (this, i, method);
}
}
diff --git a/languages/mono/MonoVoidType.cs b/languages/mono/MonoVoidType.cs
index 9f80438..cd435e4 100644
--- a/languages/mono/MonoVoidType.cs
+++ b/languages/mono/MonoVoidType.cs
@@ -22,7 +22,7 @@ namespace Mono.Debugger.Languages.Mono
public static MonoVoidType Create (MonoSymbolFile corlib, TargetMemoryAccess memory)
{
MonoVoidType type = new MonoVoidType (
- corlib, corlib.ModuleDefinition.GetType ("System.Void"));
+ corlib, corlib.ModuleDefinition.Types ["System.Void"]);
TargetAddress klass = corlib.MonoLanguage.MetadataHelper.GetVoidClass (memory);
type.create_type (memory, klass);
diff --git a/languages/native/Makefile.in b/languages/native/Makefile.in
index ac3d319..563e073 100644
--- a/languages/native/Makefile.in
+++ b/languages/native/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/languages/native/NativeLanguage.cs b/languages/native/NativeLanguage.cs
index 5d75340..2ddb755 100644
--- a/languages/native/NativeLanguage.cs
+++ b/languages/native/NativeLanguage.cs
@@ -9,7 +9,7 @@ namespace Mono.Debugger.Languages.Native
{
internal class NativeLanguage : Language
{
- Process process;
+ ProcessServant process;
OperatingSystemBackend os;
TargetFundamentalType unsigned_type;
TargetFundamentalType integer_type;
@@ -22,7 +22,7 @@ namespace Mono.Debugger.Languages.Native
Hashtable type_hash;
- public NativeLanguage (Process process, OperatingSystemBackend os, TargetInfo info)
+ public NativeLanguage (ProcessServant process, OperatingSystemBackend os, TargetInfo info)
{
this.process = process;
this.os = os;
@@ -51,7 +51,7 @@ namespace Mono.Debugger.Languages.Native
get { return false; }
}
- internal override Process Process {
+ internal override ProcessServant Process {
get { return process; }
}
diff --git a/languages/native/NativeStructObject.cs b/languages/native/NativeStructObject.cs
index 1c861eb..c923cf0 100644
--- a/languages/native/NativeStructObject.cs
+++ b/languages/native/NativeStructObject.cs
@@ -14,7 +14,7 @@ namespace Mono.Debugger.Languages.Native
internal override TargetClassObject GetParentObject (TargetMemoryAccess target)
{
- return type.GetParentObject (target, Location);
+ return null;
}
internal override TargetClassObject GetCurrentObject (TargetMemoryAccess target)
diff --git a/languages/native/NativeStructType.cs b/languages/native/NativeStructType.cs
index ec2d77d..72ea4c2 100644
--- a/languages/native/NativeStructType.cs
+++ b/languages/native/NativeStructType.cs
@@ -74,26 +74,12 @@ namespace Mono.Debugger.Languages.Native
}
}
- internal abstract class NativeBaseInfo
- {
- public readonly NativeStructType BaseType;
-
- public NativeBaseInfo (NativeStructType base_type)
- {
- this.BaseType = base_type;
- }
-
- public abstract TargetLocation GetBaseLocation (TargetMemoryAccess memory,
- TargetLocation location);
- }
-
internal class NativeStructType : TargetClassType
{
string name;
int size;
NativeFieldInfo[] fields;
NativeClass class_info;
- NativeBaseInfo base_info;
internal NativeStructType (Language language, string name, int size)
: base (language, TargetObjectKind.Struct)
@@ -109,15 +95,6 @@ namespace Mono.Debugger.Languages.Native
this.fields = fields;
}
- internal NativeStructType (Language language, string name, int size,
- NativeBaseInfo base_info)
- : base (language, base_info != null ? TargetObjectKind.Class : TargetObjectKind.Struct)
- {
- this.name = name;
- this.size = size;
- this.base_info = base_info;
- }
-
public override bool HasClassType {
get { return true; }
}
@@ -131,15 +108,12 @@ namespace Mono.Debugger.Languages.Native
}
public override bool HasParent {
- get { return base_info != null; }
+ get { return false; }
}
internal override TargetClassType GetParentType (TargetMemoryAccess target)
{
- if (!HasParent)
- throw new InvalidOperationException ();
-
- return base_info.BaseType;
+ throw new InvalidOperationException ();
}
public override Module Module {
@@ -259,14 +233,5 @@ namespace Mono.Debugger.Languages.Native
// field.Type.SetObject (field_loc, obj);
throw new NotImplementedException ();
}
-
- internal NativeStructObject GetParentObject (TargetMemoryAccess target, TargetLocation location)
- {
- if (!HasParent)
- throw new InvalidOperationException ();
-
- location = base_info.GetBaseLocation (target, location);
- return new NativeStructObject (base_info.BaseType, location);
- }
}
}
diff --git a/symbolwriter/Makefile.in b/symbolwriter/Makefile.in
index 828ff06..81909c3 100644
--- a/symbolwriter/Makefile.in
+++ b/symbolwriter/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/symbolwriter/MdbSymbolReader.cs b/symbolwriter/MdbSymbolReader.cs
index dbb9cf1..ed52c1d 100644
--- a/symbolwriter/MdbSymbolReader.cs
+++ b/symbolwriter/MdbSymbolReader.cs
@@ -174,8 +174,8 @@ namespace Mono.Debugger.SymbolWriter
if (method == null)
throw new MonoSymbolFileException ("Cannot get method {0}.", i+1);
- Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupToken (
- new Cecil.MetadataToken (Cecil.TokenType.Method, method.Token & 0xffffff));
+ Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupByToken (
+ Cecil.Metadata.TokenType.Method, method.Token & 0xffffff);
if ((mdef == null) || (mdef.Body == null))
throw new MonoSymbolFileException ("Method {0} (token {1:x}) not found in assembly.",
method.Index, method.Token);
@@ -215,8 +215,8 @@ namespace Mono.Debugger.SymbolWriter
if (method == null)
throw new MonoSymbolFileException ("Cannot get method {0}.", i+1);
- Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupToken (
- new Cecil.MetadataToken (Cecil.TokenType.Method, method.Token & 0xffffff));
+ Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupByToken (
+ Cecil.Metadata.TokenType.Method, method.Token & 0xffffff);
if ((mdef == null) || (mdef.Body == null))
throw new MonoSymbolFileException ("Method {0} (token {1:x}) not found in assembly.",
method.Index, method.Token);
@@ -328,7 +328,7 @@ namespace Mono.Debugger.SymbolWriter
protected static string GetTypeSignature (Cecil.TypeReference t)
{
- Cecil.ByReferenceType rtype = t as Cecil.ByReferenceType;
+ Cecil.ReferenceType rtype = t as Cecil.ReferenceType;
if (rtype != null)
return GetTypeSignature (rtype.ElementType) + "&";
@@ -440,8 +440,8 @@ namespace Mono.Debugger.SymbolWriter
protected void CheckMethod (MethodEntry method)
{
- Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupToken (
- new Cecil.MetadataToken (Cecil.TokenType.Method, method.Token & 0xffffff));
+ Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupByToken (
+ Cecil.Metadata.TokenType.Method, method.Token & 0xffffff);
if ((mdef == null) || (mdef.Body == null))
throw new MonoSymbolFileException ("Method {0} (token {1:x}) not found in assembly.",
method.Index, method.Token);
@@ -551,8 +551,8 @@ namespace Mono.Debugger.SymbolWriter
Mono.Cecil.AssemblyDefinition asm;
try {
- asm = Mono.Cecil.AssemblyDefinition.ReadAssembly (filename);
- file = MonoSymbolFile.ReadSymbolFile (asm.MainModule, filename + ".mdb");
+ asm = Mono.Cecil.AssemblyFactory.GetAssembly (filename);
+ file = MonoSymbolFile.ReadSymbolFile (asm, filename + ".mdb");
} catch (Exception ex) {
Console.WriteLine ("Can't read {0}: {1}", filename, ex.Message);
return -1;
diff --git a/symbolwriter/MonoSymbolFile.cs b/symbolwriter/MonoSymbolFile.cs
index bd2920f..96ace3b 100644
--- a/symbolwriter/MonoSymbolFile.cs
+++ b/symbolwriter/MonoSymbolFile.cs
@@ -449,22 +449,16 @@ namespace Mono.CompilerServices.SymbolWriter
}
#if CECIL
- protected MonoSymbolFile (string filename, Mono.Cecil.ModuleDefinition module)
- : this (filename)
+ protected MonoSymbolFile (string filename, Mono.Cecil.AssemblyDefinition assembly) : this (filename)
{
- CheckGuidMatch (module.Mvid, filename, module.FullyQualifiedName);
- }
+ Guid mvid = assembly.MainModule.Mvid;
- public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.ModuleDefinition module)
- {
- return ReadSymbolFile (module, module.FullyQualifiedName);
+ CheckGuidMatch (mvid, filename, assembly.MainModule.Image.FileInformation.FullName);
}
- public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.ModuleDefinition module, string filename)
+ public static MonoSymbolFile ReadSymbolFile (Mono.Cecil.AssemblyDefinition assembly, string filename)
{
- string name = filename + ".mdb";
-
- return new MonoSymbolFile (name, module);
+ return new MonoSymbolFile (filename, assembly);
}
#else
protected MonoSymbolFile (string filename, Assembly assembly) : this (filename)
diff --git a/sysdeps/Makefile.am b/sysdeps/Makefile.am
deleted file mode 100644
index 017026f..0000000
--- a/sysdeps/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = bfd server
diff --git a/sysdeps/Makefile.in b/sysdeps/Makefile.in
deleted file mode 100644
index 30683fe..0000000
--- a/sysdeps/Makefile.in
+++ /dev/null
@@ -1,525 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = bfd server
-all: all-recursive
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- distdir=`$(am__cd) $(distdir) && pwd`; \
- top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
- (cd $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$top_distdir" \
- distdir="$$distdir/$$subdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- distdir) \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-recursive
-all-am: Makefile
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-recursive
- -rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-info: install-info-recursive
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-ps: install-ps-recursive
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/Makefile.in b/sysdeps/bfd/Makefile.in
deleted file mode 100644
index 9407209..0000000
--- a/sysdeps/bfd/Makefile.in
+++ /dev/null
@@ -1,725 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libbfd_la_DEPENDENCIES = libiberty/libiberty.la
-am__libbfd_la_SOURCES_DIST = elf32-i386.c elf32.c elf.c elflink.c \
- elf-strtab.c elf-eh-frame.c dwarf1.c i386linux.c aout32.c \
- efi-app-ia32.c peigen.c cofflink.c elf32-gen.c cpu-i386.c \
- pe-i386.c pei-i386.c trad-core.c mach-o.c pef.c xsym.c \
- elf64-x86-64.c elf64.c elf64-gen.c archive64.c rs6000-core.c \
- cpu-rs6000.c cpu-powerpc.c archive.c archures.c bfd.c cache.c \
- coffgen.c corefile.c format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c srec.c binary.c \
- tekhex.c ihex.c stabs.c stab-syms.c merge.c dwarf2.c bfdio.c \
- simple.c
-am__objects_1 = elf32-i386.lo elf32.lo elf.lo elflink.lo elf-strtab.lo \
- elf-eh-frame.lo dwarf1.lo i386linux.lo aout32.lo \
- efi-app-ia32.lo peigen.lo cofflink.lo elf32-gen.lo cpu-i386.lo \
- pe-i386.lo pei-i386.lo trad-core.lo
-am__objects_2 = mach-o.lo pef.lo xsym.lo cpu-i386.lo
-am__objects_3 = elf64-x86-64.lo elf64.lo elf32-i386.lo elf32.lo elf.lo \
- elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo \
- i386linux.lo aout32.lo efi-app-ia32.lo peigen.lo cofflink.lo \
- elf64-gen.lo elf32-gen.lo cpu-i386.lo pe-i386.lo pei-i386.lo \
- trad-core.lo archive64.lo
-am__objects_4 = mach-o.lo pef.lo rs6000-core.lo xsym.lo cpu-rs6000.lo \
- cpu-powerpc.lo
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at am__objects_5 = $(am__objects_1)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at am__objects_5 = $(am__objects_2)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at am__objects_5 = $(am__objects_3)
- at BFD_TARGET_POWERPC_TRUE@am__objects_5 = $(am__objects_4) \
- at BFD_TARGET_POWERPC_TRUE@ $(am__objects_1)
-am__objects_6 = archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
- corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo srec.lo \
- binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo \
- dwarf2.lo bfdio.lo simple.lo
-am_libbfd_la_OBJECTS = $(am__objects_5) $(am__objects_6)
-libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
-libbfd_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libbfd_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libbfd_la_SOURCES)
-DIST_SOURCES = $(am__libbfd_la_SOURCES_DIST)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = include hosts libiberty opcodes
-INCDIR = $(srcdir)/include
-CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
-noinst_LTLIBRARIES = libbfd.la
-AM_CFLAGS = $(WARN_CFLAGS)
-powerpc_backend = mach-o.c pef.c rs6000-core.c xsym.c cpu-rs6000.c cpu-powerpc.c
-powerpc_vec_defines = -DHAVE_mach_o_be_vec -DHAVE_mach_o_le_vec -DHAVE_mach_o_fat_vec -DHAVE_pef_vec -DHAVE_pef_xlib_vec -DHAVE_sym_vec
-i386_linux_backend = elf32-i386.c elf32.c elf.c elflink.c elf-strtab.c elf-eh-frame.c dwarf1.c i386linux.c aout32.c efi-app-ia32.c peigen.c cofflink.c elf32-gen.c cpu-i386.c pe-i386.c pei-i386.c trad-core.c
-i386_linux_vec_defines = -DHAVE_bfd_elf32_i386_vec -DHAVE_i386linux_vec -DHAVE_bfd_efi_app_ia32_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DHAVE_i386pe_vec -DHAVE_i386pei_vec
-x86_64_linux_backend = elf64-x86-64.c elf64.c elf32-i386.c elf32.c elf.c elflink.c elf-strtab.c elf-eh-frame.c dwarf1.c i386linux.c aout32.c efi-app-ia32.c peigen.c cofflink.c elf64-gen.c elf32-gen.c cpu-i386.c pe-i386.c pei-i386.c trad-core.c archive64.c
-x86_64_linux_vec_defines = -DHAVE_bfd_elf64_x86_64_vec -DHAVE_bfd_elf32_i386_vec -DHAVE_i386linux_vec -DHAVE_bfd_efi_app_ia32_vec -DHAVE_bfd_elf64_little_generic_vec -DHAVE_bfd_elf64_big_generic_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec
-i386_mach_backend = mach-o.c pef.c xsym.c cpu-i386.c
-i386_mach_vec_defines = -DHAVE_mach_o_be_vec -DHAVE_mach_o_le_vec -DHAVE_mach_o_fat_vec -DHAVE_pef_vec -DHAVE_pef_xlib_vec -DHAVE_sym_vec
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at BFD_BACKEND = $(i386_linux_backend)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at BFD_BACKEND = $(i386_mach_backend)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at BFD_BACKEND = $(x86_64_linux_backend)
- at BFD_TARGET_POWERPC_TRUE@BFD_BACKEND = $(powerpc_backend) $(i386_linux_backend)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at TDEFAULTS = -DDEFAULT_VECTOR=bfd_elf32_i386_vec -DSELECT_VECS='&bfd_elf32_i386_vec,&i386linux_vec,&bfd_efi_app_ia32_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec,&i386pe_vec,&i386pei_vec' -DSELECT_ARCHITECTURES='&bfd_i386_arch' $(i386_linux_vec_defines)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at TDEFAULTS = -DDEFAULT_VECTOR=mach_o_be_vec -DSELECT_VECS='&mach_o_be_vec,&mach_o_le_vec,&mach_o_fat_vec,&pef_vec,&pef_xlib_vec,&sym_vec' -DSELECT_ARCHITECTURES='&bfd_i386_arch' $(i386_mach_vec_defines)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at TDEFAULTS = -DDEFAULT_VECTOR=bfd_elf64_x86_64_vec -DSELECT_VECS='&bfd_elf64_x86_64_vec,&bfd_elf32_i386_vec,&i386linux_vec,&bfd_efi_app_ia32_vec,&bfd_elf64_little_generic_vec,&bfd_elf64_big_generic_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec' -DSELECT_ARCHITECTURES='&bfd_i386_arch' $(x86_64_linux_vec_defines)
- at BFD_TARGET_POWERPC_TRUE@TDEFAULTS = -DDEFAULT_VECTOR=mach_o_be_vec -DSELECT_VECS='&mach_o_be_vec,&mach_o_le_vec,&mach_o_fat_vec,&pef_vec,&pef_xlib_vec,&sym_vec,&bfd_elf32_i386_vec,&i386linux_vec,&bfd_efi_app_ia32_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec,&i386pe_vec,&i386pei_vec' -DSELECT_ARCHITECTURES='&bfd_powerpc_arch,&bfd_rs6000_arch,&bfd_i386_arch' $(powerpc_vec_defines) $(i386_linux_vec_defines)
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_FALSE at bfd_cflags = -DTRAD_CORE
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE@@BFD_TARGET_X86_MACH_TRUE at bfd_cflags =
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at bfd_cflags = -DTRAD_CORE -DBFD64
- at BFD_TARGET_POWERPC_TRUE@bfd_cflags =
-INCLUDES = -D_GNU_SOURCE $(bfd_cflags) $(CSEARCH) $(CSWITCHES)
-SOURCE_FILES = \
- archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
- srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- merge.c dwarf2.c bfdio.c simple.c
-
-libbfd_la_SOURCES = $(BFD_BACKEND) $(SOURCE_FILES)
-libbfd_la_LDFLAGS = -export-dynamic
-libbfd_la_LIBADD = libiberty/libiberty.la
-EXTRA_DIST = coff-i386.c peigen.c aout-target.h aoutx.h bfd.h bfd-in2.h bfd-in.h coffcode.h \
- coffswap.h elf32-target.h elf-bfd.h elfcode.h elfcore.h elflink.h genlink.h libaout.h \
- libbfd.h libbfd-in.h libcoff.h libcoff-in.h libecoff.h libpei.h peicode.h sysdep.h \
- targmatch.h version.h bfdver.h elf64-target.h
-
-all: all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
- $(libbfd_la_LINK) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/aout32.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/archive.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/archive64.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/archures.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bfd.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bfdio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/binary.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cache.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/coffgen.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cofflink.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/corefile.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu-i386.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu-powerpc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cpu-rs6000.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dwarf1.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dwarf2.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/efi-app-ia32.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf-eh-frame.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf-strtab.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf32-gen.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf32-i386.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf32.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf64-gen.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf64-x86-64.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elf64.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elflink.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/format.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hash.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/i386linux.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ihex.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/init.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libbfd.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/linker.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mach-o.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/merge.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/opncls.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pe-i386.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pef.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pei-i386.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/peigen.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/reloc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rs6000-core.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/section.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/srec.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stab-syms.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stabs.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/syms.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/targets.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tekhex.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trad-core.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xsym.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- distdir=`$(am__cd) $(distdir) && pwd`; \
- top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
- (cd $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$top_distdir" \
- distdir="$$distdir/$$subdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- distdir) \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(LTLIBRARIES)
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-recursive
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-info: install-info-recursive
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-ps: install-ps-recursive
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
-
-
-# When compiling archures.c and targets.c, supply the default target
-# info from configure.
-
-targets.lo: targets.c Makefile
- $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
-
-archures.lo: archures.c Makefile
- $(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/hosts/Makefile.in b/sysdeps/bfd/hosts/Makefile.in
deleted file mode 100644
index 326b499..0000000
--- a/sysdeps/bfd/hosts/Makefile.in
+++ /dev/null
@@ -1,367 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/hosts
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-EXTRA_DIST = i386linux.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/hosts/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/hosts/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/include/Makefile.in b/sysdeps/bfd/include/Makefile.in
deleted file mode 100644
index b85b1ab..0000000
--- a/sysdeps/bfd/include/Makefile.in
+++ /dev/null
@@ -1,528 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/include
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = aout coff elf opcode
-EXTRA_DIST = ansidecl.h bfdlink.h dis-asm.h filenames.h fnmatch.h fopen-same.h hashtab.h \
- libiberty.h objalloc.h safe-ctype.h symcat.h
-
-all: all-recursive
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/include/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/include/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- distdir=`$(am__cd) $(distdir) && pwd`; \
- top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
- (cd $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$top_distdir" \
- distdir="$$distdir/$$subdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- distdir) \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-recursive
-all-am: Makefile
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-recursive
- -rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-info: install-info-recursive
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-ps: install-ps-recursive
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/include/aout/Makefile.in b/sysdeps/bfd/include/aout/Makefile.in
deleted file mode 100644
index 40f6ac5..0000000
--- a/sysdeps/bfd/include/aout/Makefile.in
+++ /dev/null
@@ -1,367 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/include/aout
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-EXTRA_DIST = stab.def aout64.h ar.h ranlib.h stab_gnu.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/include/aout/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/include/aout/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/include/coff/Makefile.in b/sysdeps/bfd/include/coff/Makefile.in
deleted file mode 100644
index 835ef19..0000000
--- a/sysdeps/bfd/include/coff/Makefile.in
+++ /dev/null
@@ -1,367 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/include/coff
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-EXTRA_DIST = ecoff.h external.h i386.h internal.h pe.h sym.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/include/coff/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/include/coff/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/include/elf/Makefile.in b/sysdeps/bfd/include/elf/Makefile.in
deleted file mode 100644
index 074a23f..0000000
--- a/sysdeps/bfd/include/elf/Makefile.in
+++ /dev/null
@@ -1,367 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/include/elf
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-EXTRA_DIST = common.h dwarf2.h dwarf.h external.h i386.h internal.h reloc-macros.h x86-64.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/include/elf/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/include/elf/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/include/opcode/Makefile.in b/sysdeps/bfd/include/opcode/Makefile.in
deleted file mode 100644
index 4037dc8..0000000
--- a/sysdeps/bfd/include/opcode/Makefile.in
+++ /dev/null
@@ -1,367 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/include/opcode
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-EXTRA_DIST = ppc.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/include/opcode/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/include/opcode/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/libiberty/Makefile.in b/sysdeps/bfd/libiberty/Makefile.in
deleted file mode 100644
index c716969..0000000
--- a/sysdeps/bfd/libiberty/Makefile.in
+++ /dev/null
@@ -1,498 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/libiberty
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libiberty_la_LIBADD =
-am_libiberty_la_OBJECTS = concat.lo hashtab.lo hex.lo objalloc.lo \
- safe-ctype.lo xexit.lo xmalloc.lo xstrerror.lo fnmatch.lo \
- basename.lo xstrdup.lo
-libiberty_la_OBJECTS = $(am_libiberty_la_OBJECTS)
-libiberty_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libiberty_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libiberty_la_SOURCES)
-DIST_SOURCES = $(libiberty_la_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CFLAGS = $(WARN_CFLAGS)
-INCLUDES = -D_GNU_SOURCE -I$(srcdir)/../include
-noinst_LTLIBRARIES = libiberty.la
-libiberty_la_SOURCES = \
- concat.c hashtab.c hex.c objalloc.c safe-ctype.c \
- xexit.c xmalloc.c xstrerror.c fnmatch.c basename.c \
- xstrdup.c
-
-libiberty_la_LDFLAGS = -export-dynamic
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/libiberty/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/libiberty/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libiberty.la: $(libiberty_la_OBJECTS) $(libiberty_la_DEPENDENCIES)
- $(libiberty_la_LINK) $(libiberty_la_OBJECTS) $(libiberty_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/basename.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/concat.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fnmatch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hashtab.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hex.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/objalloc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/safe-ctype.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xexit.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmalloc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xstrdup.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xstrerror.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/bfd/opcodes/Makefile.in b/sysdeps/bfd/opcodes/Makefile.in
deleted file mode 100644
index 51bd35f..0000000
--- a/sysdeps/bfd/opcodes/Makefile.in
+++ /dev/null
@@ -1,499 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/bfd/opcodes
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libopcodes_la_LIBADD =
-am__libopcodes_la_SOURCES_DIST = dis-buf.c disassemble.c i386-dis.c \
- ppc-dis.c ppc-opc.c
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE at am__objects_1 = i386-dis.lo
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at am__objects_1 = \
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE@ i386-dis.lo
- at BFD_TARGET_POWERPC_TRUE@am__objects_1 = i386-dis.lo ppc-dis.lo \
- at BFD_TARGET_POWERPC_TRUE@ ppc-opc.lo
-am_libopcodes_la_OBJECTS = dis-buf.lo disassemble.lo $(am__objects_1)
-libopcodes_la_OBJECTS = $(am_libopcodes_la_OBJECTS)
-libopcodes_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libopcodes_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libopcodes_la_SOURCES)
-DIST_SOURCES = $(am__libopcodes_la_SOURCES_DIST)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-noinst_LTLIBRARIES = libopcodes.la
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE at arch_cflags = -DARCH_i386
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at arch_cflags = -DARCH_i386 -DBFD64
- at BFD_TARGET_POWERPC_TRUE@arch_cflags = -DARCH_powerpc -DARCH_i386
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_FALSE at arch_sources = i386-dis.c
- at BFD_TARGET_POWERPC_FALSE@@BFD_TARGET_X86_64_TRUE at arch_sources = i386-dis.c
- at BFD_TARGET_POWERPC_TRUE@arch_sources = i386-dis.c ppc-dis.c ppc-opc.c
-INCLUDES = -D_GNU_SOURCE $(arch_cflags) -I$(srcdir)/.. -I$(srcdir)/../include
-libopcodes_la_SOURCES = dis-buf.c disassemble.c $(arch_sources)
-libopcodes_la_LDFLAGS = -export-dynamic
-EXTRA_DIST = opintl.h sysdep.h
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/bfd/opcodes/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/bfd/opcodes/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libopcodes.la: $(libopcodes_la_OBJECTS) $(libopcodes_la_DEPENDENCIES)
- $(libopcodes_la_LINK) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dis-buf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/disassemble.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/i386-dis.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ppc-dis.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ppc-opc.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/server/Makefile.am b/sysdeps/server/Makefile.am
deleted file mode 100644
index dad57ab..0000000
--- a/sysdeps/server/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-lib_LTLIBRARIES = libmonodebuggerserver.la
-
-noinst_LTLIBRARIES = libmonodebuggerbfdglue.la
-
-libmonodebuggerbfdglue_la_SOURCES = \
- bfdglue.c \
- bfdglue.h
-
-libmonodebuggerbfdglue_la_LIBADD = \
- ../../sysdeps/bfd/opcodes/libopcodes.la ../../sysdeps/bfd/libbfd.la
-libmonodebuggerbfdglue_la_LDFLAGS = \
- -no-undefined -module -export-dynamic -shared
-
-libmonodebuggerbfdglue_la_CPPFLAGS = \
- -I$(top_srcdir)/sysdeps/bfd \
- -I$(top_srcdir)/sysdeps/bfd/include \
- -I$(top_srcdir)/sysdeps/bfd/opcodes \
- @SERVER_DEPENDENCIES_CFLAGS@ @server_cflags@
-
-EXTRA_libmonodebuggerserver_la_SOURCES = \
- i386-arch.c \
- i386-arch.h \
- x86-arch.h \
- x86_64-arch.h \
- x86_64-arch.c \
- x86-linux-ptrace.c \
- x86-linux-ptrace.h \
- x86-ptrace.c \
- x86-ptrace.h
-if PLATFORM_POWERPC
-platform_sources =
-else
-if PLATFORM_X86_DARWIN
-platform_sources = \
- x86-ptrace.c \
- darwin-thread-db.c \
- thread-db.h
-libmonodebuggerserver_la_LIBADD = \
- @SERVER_DEPENDENCIES_LIBS@ \
- ../../sysdeps/bfd/libbfd.la
-else
-platform_sources = \
- x86-ptrace.c \
- thread-db.c \
- thread-db.h
-libmonodebuggerserver_la_LIBADD = \
- @SERVER_DEPENDENCIES_LIBS@ -lthread_db \
- libmonodebuggerbfdglue.la
-
-endif
-endif
-
-libmonodebuggerserver_la_CPPFLAGS = @SERVER_DEPENDENCIES_CFLAGS@ @server_cflags@
-
-libmonodebuggerserver_la_SOURCES = \
- server.h \
- library.c \
- $(platform_sources) \
- breakpoints.c \
- breakpoints.h \
- libgtop-glue.c \
- libgtop-glue.h \
- linux-proc-service.h
-
-libmonodebuggerserver_la_LDFLAGS = \
- -no-undefined -export-dynamic -shared
-
-CLEANFILES = lib*.a lib*.dll
diff --git a/sysdeps/server/Makefile.in b/sysdeps/server/Makefile.in
deleted file mode 100644
index e660e6c..0000000
--- a/sysdeps/server/Makefile.in
+++ /dev/null
@@ -1,689 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sysdeps/server
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(libdir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
-libmonodebuggerbfdglue_la_DEPENDENCIES = \
- ../../sysdeps/bfd/opcodes/libopcodes.la \
- ../../sysdeps/bfd/libbfd.la
-am_libmonodebuggerbfdglue_la_OBJECTS = \
- libmonodebuggerbfdglue_la-bfdglue.lo
-libmonodebuggerbfdglue_la_OBJECTS = \
- $(am_libmonodebuggerbfdglue_la_OBJECTS)
-libmonodebuggerbfdglue_la_LINK = $(LIBTOOL) --tag=CC \
- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
- $(AM_CFLAGS) $(CFLAGS) $(libmonodebuggerbfdglue_la_LDFLAGS) \
- $(LDFLAGS) -o $@
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at libmonodebuggerserver_la_DEPENDENCIES = libmonodebuggerbfdglue.la
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at libmonodebuggerserver_la_DEPENDENCIES = ../../sysdeps/bfd/libbfd.la
-am__libmonodebuggerserver_la_SOURCES_DIST = server.h library.c \
- x86-ptrace.c thread-db.c thread-db.h darwin-thread-db.c \
- breakpoints.c breakpoints.h libgtop-glue.c libgtop-glue.h \
- linux-proc-service.h
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at am__objects_1 = libmonodebuggerserver_la-x86-ptrace.lo \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ libmonodebuggerserver_la-thread-db.lo
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at am__objects_1 = libmonodebuggerserver_la-x86-ptrace.lo \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ libmonodebuggerserver_la-darwin-thread-db.lo
-am_libmonodebuggerserver_la_OBJECTS = \
- libmonodebuggerserver_la-library.lo $(am__objects_1) \
- libmonodebuggerserver_la-breakpoints.lo \
- libmonodebuggerserver_la-libgtop-glue.lo
-libmonodebuggerserver_la_OBJECTS = \
- $(am_libmonodebuggerserver_la_OBJECTS)
-libmonodebuggerserver_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libmonodebuggerserver_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libmonodebuggerbfdglue_la_SOURCES) \
- $(libmonodebuggerserver_la_SOURCES) \
- $(EXTRA_libmonodebuggerserver_la_SOURCES)
-DIST_SOURCES = $(libmonodebuggerbfdglue_la_SOURCES) \
- $(am__libmonodebuggerserver_la_SOURCES_DIST) \
- $(EXTRA_libmonodebuggerserver_la_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@
-BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@
-BUILD_EXEEXT = @BUILD_EXEEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CECIL_ASM = @CECIL_ASM@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GACUTIL = @GACUTIL@
-GACUTIL_FLAGS = @GACUTIL_FLAGS@
-GREP = @GREP@
-HOST_CC = @HOST_CC@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LD_LIBRARY_PATH = @LD_LIBRARY_PATH@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_PREFIX = @LIB_PREFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MCS = @MCS@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONODIS = @MONODIS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NUNIT_CONSOLE = @NUNIT_CONSOLE@
-NUNIT_PREFIX = @NUNIT_PREFIX@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH = @PATH@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-SED = @SED@
-SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
-SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TARGET_MCS = @TARGET_MCS@
-TARGET_MONO = @TARGET_MONO@
-TARGET_MONODIS = @TARGET_MONODIS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-WRAPPER_CFLAGS = @WRAPPER_CFLAGS@
-WRAPPER_LIBS = @WRAPPER_LIBS@
-XSP_CFLAGS = @XSP_CFLAGS@
-XSP_EXE = @XSP_EXE@
-XSP_LIBS = @XSP_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-glue_cflags = @glue_cflags@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mono_prefix = @mono_prefix@
-monodoc_prefix = @monodoc_prefix@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-real_top_srcdir = @real_top_srcdir@
-sbindir = @sbindir@
-server_cflags = @server_cflags@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_mono_prefix = @target_mono_prefix@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-lib_LTLIBRARIES = libmonodebuggerserver.la
-noinst_LTLIBRARIES = libmonodebuggerbfdglue.la
-libmonodebuggerbfdglue_la_SOURCES = \
- bfdglue.c \
- bfdglue.h
-
-libmonodebuggerbfdglue_la_LIBADD = \
- ../../sysdeps/bfd/opcodes/libopcodes.la ../../sysdeps/bfd/libbfd.la
-
-libmonodebuggerbfdglue_la_LDFLAGS = \
- -no-undefined -module -export-dynamic -shared
-
-libmonodebuggerbfdglue_la_CPPFLAGS = \
- -I$(top_srcdir)/sysdeps/bfd \
- -I$(top_srcdir)/sysdeps/bfd/include \
- -I$(top_srcdir)/sysdeps/bfd/opcodes \
- @SERVER_DEPENDENCIES_CFLAGS@ @server_cflags@
-
-EXTRA_libmonodebuggerserver_la_SOURCES = \
- i386-arch.c \
- i386-arch.h \
- x86-arch.h \
- x86_64-arch.h \
- x86_64-arch.c \
- x86-linux-ptrace.c \
- x86-linux-ptrace.h \
- x86-ptrace.c \
- x86-ptrace.h
-
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at platform_sources = \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ x86-ptrace.c \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ thread-db.c \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ thread-db.h
-
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at platform_sources = \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ x86-ptrace.c \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ darwin-thread-db.c \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ thread-db.h
-
- at PLATFORM_POWERPC_TRUE@platform_sources =
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE at libmonodebuggerserver_la_LIBADD = \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ @SERVER_DEPENDENCIES_LIBS@ -lthread_db \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_FALSE@ libmonodebuggerbfdglue.la
-
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE at libmonodebuggerserver_la_LIBADD = \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ @SERVER_DEPENDENCIES_LIBS@ \
- at PLATFORM_POWERPC_FALSE@@PLATFORM_X86_DARWIN_TRUE@ ../../sysdeps/bfd/libbfd.la
-
-libmonodebuggerserver_la_CPPFLAGS = @SERVER_DEPENDENCIES_CFLAGS@ @server_cflags@
-libmonodebuggerserver_la_SOURCES = \
- server.h \
- library.c \
- $(platform_sources) \
- breakpoints.c \
- breakpoints.h \
- libgtop-glue.c \
- libgtop-glue.h \
- linux-proc-service.h
-
-libmonodebuggerserver_la_LDFLAGS = \
- -no-undefined -export-dynamic -shared
-
-CLEANFILES = lib*.a lib*.dll
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sysdeps/server/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu sysdeps/server/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- f=$(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
- else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- p=$(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
- done
-
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libmonodebuggerbfdglue.la: $(libmonodebuggerbfdglue_la_OBJECTS) $(libmonodebuggerbfdglue_la_DEPENDENCIES)
- $(libmonodebuggerbfdglue_la_LINK) $(libmonodebuggerbfdglue_la_OBJECTS) $(libmonodebuggerbfdglue_la_LIBADD) $(LIBS)
-libmonodebuggerserver.la: $(libmonodebuggerserver_la_OBJECTS) $(libmonodebuggerserver_la_DEPENDENCIES)
- $(libmonodebuggerserver_la_LINK) -rpath $(libdir) $(libmonodebuggerserver_la_OBJECTS) $(libmonodebuggerserver_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerbfdglue_la-bfdglue.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-breakpoints.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-darwin-thread-db.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-i386-arch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-libgtop-glue.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-library.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-thread-db.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-x86-linux-ptrace.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-x86-ptrace.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonodebuggerserver_la-x86_64-arch.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
- at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-libmonodebuggerbfdglue_la-bfdglue.lo: bfdglue.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerbfdglue_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerbfdglue_la-bfdglue.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerbfdglue_la-bfdglue.Tpo -c -o libmonodebuggerbfdglue_la-bfdglue.lo `test -f 'bfdglue.c' || echo '$(srcdir)/'`bfdglue.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerbfdglue_la-bfdglue.Tpo $(DEPDIR)/libmonodebuggerbfdglue_la-bfdglue.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bfdglue.c' object='libmonodebuggerbfdglue_la-bfdglue.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerbfdglue_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerbfdglue_la-bfdglue.lo `test -f 'bfdglue.c' || echo '$(srcdir)/'`bfdglue.c
-
-libmonodebuggerserver_la-library.lo: library.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-library.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-library.Tpo -c -o libmonodebuggerserver_la-library.lo `test -f 'library.c' || echo '$(srcdir)/'`library.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-library.Tpo $(DEPDIR)/libmonodebuggerserver_la-library.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='library.c' object='libmonodebuggerserver_la-library.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-library.lo `test -f 'library.c' || echo '$(srcdir)/'`library.c
-
-libmonodebuggerserver_la-x86-ptrace.lo: x86-ptrace.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-x86-ptrace.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-x86-ptrace.Tpo -c -o libmonodebuggerserver_la-x86-ptrace.lo `test -f 'x86-ptrace.c' || echo '$(srcdir)/'`x86-ptrace.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-x86-ptrace.Tpo $(DEPDIR)/libmonodebuggerserver_la-x86-ptrace.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86-ptrace.c' object='libmonodebuggerserver_la-x86-ptrace.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-x86-ptrace.lo `test -f 'x86-ptrace.c' || echo '$(srcdir)/'`x86-ptrace.c
-
-libmonodebuggerserver_la-thread-db.lo: thread-db.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-thread-db.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-thread-db.Tpo -c -o libmonodebuggerserver_la-thread-db.lo `test -f 'thread-db.c' || echo '$(srcdir)/'`thread-db.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-thread-db.Tpo $(DEPDIR)/libmonodebuggerserver_la-thread-db.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='thread-db.c' object='libmonodebuggerserver_la-thread-db.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-thread-db.lo `test -f 'thread-db.c' || echo '$(srcdir)/'`thread-db.c
-
-libmonodebuggerserver_la-darwin-thread-db.lo: darwin-thread-db.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-darwin-thread-db.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-darwin-thread-db.Tpo -c -o libmonodebuggerserver_la-darwin-thread-db.lo `test -f 'darwin-thread-db.c' || echo '$(srcdir)/'`darwin-thread-db.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-darwin-thread-db.Tpo $(DEPDIR)/libmonodebuggerserver_la-darwin-thread-db.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='darwin-thread-db.c' object='libmonodebuggerserver_la-darwin-thread-db.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-darwin-thread-db.lo `test -f 'darwin-thread-db.c' || echo '$(srcdir)/'`darwin-thread-db.c
-
-libmonodebuggerserver_la-breakpoints.lo: breakpoints.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-breakpoints.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-breakpoints.Tpo -c -o libmonodebuggerserver_la-breakpoints.lo `test -f 'breakpoints.c' || echo '$(srcdir)/'`breakpoints.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-breakpoints.Tpo $(DEPDIR)/libmonodebuggerserver_la-breakpoints.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='breakpoints.c' object='libmonodebuggerserver_la-breakpoints.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-breakpoints.lo `test -f 'breakpoints.c' || echo '$(srcdir)/'`breakpoints.c
-
-libmonodebuggerserver_la-libgtop-glue.lo: libgtop-glue.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-libgtop-glue.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-libgtop-glue.Tpo -c -o libmonodebuggerserver_la-libgtop-glue.lo `test -f 'libgtop-glue.c' || echo '$(srcdir)/'`libgtop-glue.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-libgtop-glue.Tpo $(DEPDIR)/libmonodebuggerserver_la-libgtop-glue.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libgtop-glue.c' object='libmonodebuggerserver_la-libgtop-glue.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-libgtop-glue.lo `test -f 'libgtop-glue.c' || echo '$(srcdir)/'`libgtop-glue.c
-
-libmonodebuggerserver_la-i386-arch.lo: i386-arch.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-i386-arch.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-i386-arch.Tpo -c -o libmonodebuggerserver_la-i386-arch.lo `test -f 'i386-arch.c' || echo '$(srcdir)/'`i386-arch.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-i386-arch.Tpo $(DEPDIR)/libmonodebuggerserver_la-i386-arch.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='i386-arch.c' object='libmonodebuggerserver_la-i386-arch.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-i386-arch.lo `test -f 'i386-arch.c' || echo '$(srcdir)/'`i386-arch.c
-
-libmonodebuggerserver_la-x86_64-arch.lo: x86_64-arch.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-x86_64-arch.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-x86_64-arch.Tpo -c -o libmonodebuggerserver_la-x86_64-arch.lo `test -f 'x86_64-arch.c' || echo '$(srcdir)/'`x86_64-arch.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-x86_64-arch.Tpo $(DEPDIR)/libmonodebuggerserver_la-x86_64-arch.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86_64-arch.c' object='libmonodebuggerserver_la-x86_64-arch.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-x86_64-arch.lo `test -f 'x86_64-arch.c' || echo '$(srcdir)/'`x86_64-arch.c
-
-libmonodebuggerserver_la-x86-linux-ptrace.lo: x86-linux-ptrace.c
- at am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmonodebuggerserver_la-x86-linux-ptrace.lo -MD -MP -MF $(DEPDIR)/libmonodebuggerserver_la-x86-linux-ptrace.Tpo -c -o libmonodebuggerserver_la-x86-linux-ptrace.lo `test -f 'x86-linux-ptrace.c' || echo '$(srcdir)/'`x86-linux-ptrace.c
- at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libmonodebuggerserver_la-x86-linux-ptrace.Tpo $(DEPDIR)/libmonodebuggerserver_la-x86-linux-ptrace.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='x86-linux-ptrace.c' object='libmonodebuggerserver_la-x86-linux-ptrace.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmonodebuggerserver_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmonodebuggerserver_la-x86-linux-ptrace.lo `test -f 'x86-linux-ptrace.c' || echo '$(srcdir)/'`x86-linux-ptrace.c
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
- for dir in "$(DESTDIR)$(libdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
- clean-noinstLTLIBRARIES mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am: install-libLTLIBRARIES
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-libLTLIBRARIES
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
- ctags distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-libLTLIBRARIES install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-libLTLIBRARIES
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sysdeps/server/library.c b/sysdeps/server/library.c
deleted file mode 100644
index 18782d0..0000000
--- a/sysdeps/server/library.c
+++ /dev/null
@@ -1,517 +0,0 @@
-#include <config.h>
-#include <server.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if defined(__linux__) || defined(__FreeBSD__)
-#include <sys/poll.h>
-#include <sys/select.h>
-#endif
-#include <errno.h>
-#include <stdio.h>
-
-#if defined(__POWERPC__)
-extern InferiorVTable powerpc_darwin_inferior;
-InferiorVTable *global_vtable = &powerpc_darwin_inferior;
-#elif defined(WIN32)
-extern InferiorVTable i386_windows_inferior;
-static InferiorVTable *global_vtable = &i386_windows_inferior;
-#else
-extern InferiorVTable i386_ptrace_inferior;
-static InferiorVTable *global_vtable = &i386_ptrace_inferior;
-#endif
-
-ServerHandle *
-mono_debugger_server_create_inferior (BreakpointManager *breakpoint_manager)
-{
- return global_vtable->create_inferior (breakpoint_manager);
-}
-
-guint32
-mono_debugger_server_get_current_pid (void)
-{
- return global_vtable->get_current_pid ();
-}
-
-guint64
-mono_debugger_server_get_current_thread (void)
-{
- return global_vtable->get_current_thread ();
-}
-
-ServerCapabilities
-mono_debugger_server_get_capabilities (void)
-{
- return global_vtable->get_capabilities ();
-}
-
-ServerType
-mono_debugger_server_get_server_type (void)
-{
- return global_vtable->get_server_type ();
-}
-
-void
-mono_debugger_server_io_thread_main (IOThreadData *io_data, ChildOutputFunc func)
-{
- (global_vtable->io_thread_main) (io_data, func);
-}
-
-ServerCommandError
-mono_debugger_server_spawn (ServerHandle *handle, const gchar *working_directory,
- const gchar **argv, const gchar **envp, gboolean redirect_fds,
- gint *child_pid, IOThreadData **io_data, gchar **error)
-{
- if (!global_vtable->spawn)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->spawn) (handle, working_directory, argv, envp, redirect_fds,
- child_pid, io_data, error);
-}
-
-ServerCommandError
-mono_debugger_server_initialize_process (ServerHandle *handle)
-{
- if (!global_vtable->initialize_process)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->initialize_process) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_initialize_thread (ServerHandle *handle, guint32 pid, gboolean wait)
-{
- if (!global_vtable->initialize_thread)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->initialize_thread) (handle, pid, wait);
-}
-
-ServerCommandError
-mono_debugger_server_attach (ServerHandle *handle, guint32 pid)
-{
- if (!global_vtable->attach)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->attach) (handle, pid);
-}
-
-void
-mono_debugger_server_finalize (ServerHandle *handle)
-{
- (* global_vtable->finalize) (handle);
-}
-
-void
-mono_debugger_server_global_init (void)
-{
- (* global_vtable->global_init) ();
-}
-
-guint32
-mono_debugger_server_global_wait (guint32 *status)
-{
- return (* global_vtable->global_wait) (status);
-}
-
-ServerStatusMessageType
-mono_debugger_server_dispatch_event (ServerHandle *handle, guint32 status, guint64 *arg,
- guint64 *data1, guint64 *data2, guint32 *opt_data_size,
- gpointer *opt_data)
-{
- return (*global_vtable->dispatch_event) (
- handle, status, arg, data1, data2, opt_data_size, opt_data);
-}
-
-ServerStatusMessageType
-mono_debugger_server_dispatch_simple (guint32 status, guint32 *arg)
-{
- return (*global_vtable->dispatch_simple) (status, arg);
-}
-
-ServerCommandError
-mono_debugger_server_get_target_info (guint32 *target_int_size, guint32 *target_long_size,
- guint32 *target_address_size, guint32 *is_bigendian)
-{
- if (!global_vtable->get_target_info)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_target_info) (
- target_int_size, target_long_size, target_address_size, is_bigendian);
-}
-
-ServerCommandError
-mono_debugger_server_get_frame (ServerHandle *handle, StackFrame *frame)
-{
- if (!global_vtable->get_frame)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_frame) (handle, frame);
-}
-
-ServerCommandError
-mono_debugger_server_current_insn_is_bpt (ServerHandle *handle, guint32 *is_breakpoint)
-{
- if (!global_vtable->current_insn_is_bpt)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->current_insn_is_bpt) (handle, is_breakpoint);
-}
-
-ServerCommandError
-mono_debugger_server_step (ServerHandle *handle)
-{
- if (!global_vtable->step)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->step) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_continue (ServerHandle *handle)
-{
- if (!global_vtable->run)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->run) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_resume (ServerHandle *handle)
-{
- if (!global_vtable->resume)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->resume) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_detach (ServerHandle *handle)
-{
- if (!global_vtable->detach)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->detach) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_peek_word (ServerHandle *handle, guint64 start, guint64 *word)
-{
- if (!global_vtable->peek_word)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->peek_word) (handle, start, word);
-}
-
-ServerCommandError
-mono_debugger_server_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer data)
-{
- if (!global_vtable->read_memory)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->read_memory) (handle, start, size, data);
-}
-
-ServerCommandError
-mono_debugger_server_write_memory (ServerHandle *handle, guint64 start, guint32 size, gconstpointer data)
-{
- if (!global_vtable->write_memory)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->write_memory) (handle, start, size, data);
-}
-
-ServerCommandError
-mono_debugger_server_call_method (ServerHandle *handle, guint64 method_address,
- guint64 method_argument1, guint64 method_argument2,
- guint64 callback_argument)
-{
- if (!global_vtable->call_method)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->call_method) (
- handle, method_address, method_argument1, method_argument2,
- callback_argument);
-}
-
-ServerCommandError
-mono_debugger_server_call_method_1 (ServerHandle *handle, guint64 method_address,
- guint64 method_argument, guint64 data_argument,
- guint64 data_argument2, const gchar *string_argument,
- guint64 callback_argument)
-{
- if (!global_vtable->call_method_1)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->call_method_1) (
- handle, method_address, method_argument, data_argument,
- data_argument2, string_argument, callback_argument);
-}
-
-ServerCommandError
-mono_debugger_server_call_method_2 (ServerHandle *handle, guint64 method_address,
- guint32 data_size, gconstpointer data_buffer,
- guint64 callback_argument)
-{
- if (!global_vtable->call_method_2)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->call_method_2) (
- handle, method_address, data_size, data_buffer, callback_argument);
-}
-
-ServerCommandError
-mono_debugger_server_call_method_3 (ServerHandle *handle, guint64 method_address,
- guint64 method_argument, guint64 address_argument,
- guint32 blob_size, gconstpointer blob_data,
- guint64 callback_argument)
-{
- if (!global_vtable->call_method_2)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->call_method_3) (
- handle, method_address, method_argument, address_argument, blob_size,
- blob_data, callback_argument);
-}
-
-ServerCommandError
-mono_debugger_server_call_method_invoke (ServerHandle *handle, guint64 invoke_method,
- guint64 method_argument, guint32 num_params,
- guint32 blob_size, guint64 *param_data,
- gint32 *offset_data, gconstpointer blob_data,
- guint64 callback_argument, gboolean debug)
-{
- if (!global_vtable->call_method_invoke)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->call_method_invoke) (
- handle, invoke_method, method_argument, num_params, blob_size,
- param_data, offset_data, blob_data, callback_argument, debug);
-}
-
-ServerCommandError
-mono_debugger_server_execute_instruction (ServerHandle *handle, const guint8 *instruction,
- guint32 insn_size, gboolean update_ip)
-{
- if (!global_vtable->execute_instruction)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->execute_instruction) (
- handle, instruction, insn_size, update_ip);
-}
-
-ServerCommandError
-mono_debugger_server_mark_rti_frame (ServerHandle *handle)
-{
- if (!global_vtable->mark_rti_frame)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->mark_rti_frame) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_abort_invoke (ServerHandle *handle, guint64 rti_id)
-{
- if (!global_vtable->abort_invoke)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->abort_invoke) (handle, rti_id);
-}
-
-ServerCommandError
-mono_debugger_server_insert_breakpoint (ServerHandle *handle, guint64 address, guint32 *breakpoint)
-{
- if (!global_vtable->insert_breakpoint)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->insert_breakpoint) (handle, address, breakpoint);
-}
-
-ServerCommandError
-mono_debugger_server_insert_hw_breakpoint (ServerHandle *handle, guint32 type, guint32 *idx,
- guint64 address, guint32 *breakpoint)
-{
- if (!global_vtable->insert_hw_breakpoint)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->insert_hw_breakpoint) (
- handle, type, idx, address, breakpoint);
-}
-
-ServerCommandError
-mono_debugger_server_remove_breakpoint (ServerHandle *handle, guint32 breakpoint)
-{
- if (!global_vtable->remove_breakpoint)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->remove_breakpoint) (handle, breakpoint);
-}
-
-ServerCommandError
-mono_debugger_server_enable_breakpoint (ServerHandle *handle, guint32 breakpoint)
-{
- if (!global_vtable->enable_breakpoint)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->enable_breakpoint) (handle, breakpoint);
-}
-
-ServerCommandError
-mono_debugger_server_disable_breakpoint (ServerHandle *handle, guint32 breakpoint)
-{
- if (!global_vtable->disable_breakpoint)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->disable_breakpoint) (handle, breakpoint);
-}
-
-ServerCommandError
-mono_debugger_server_get_registers (ServerHandle *handle, guint64 *values)
-{
- if (!global_vtable->get_registers)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_registers) (handle, values);
-}
-
-ServerCommandError
-mono_debugger_server_set_registers (ServerHandle *handle, guint64 *values)
-{
- if (!global_vtable->set_registers)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->set_registers) (handle, values);
-}
-
-ServerCommandError
-mono_debugger_server_stop (ServerHandle *handle)
-{
- if (!global_vtable->stop)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->stop) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_stop_and_wait (ServerHandle *handle, guint32 *status)
-{
- if (!global_vtable->stop_and_wait)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->stop_and_wait) (handle, status);
-}
-
-ServerCommandError
-mono_debugger_server_set_signal (ServerHandle *handle, guint32 sig, guint32 send_it)
-{
- if (!global_vtable->set_signal)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->set_signal) (handle, sig, send_it);
-}
-
-ServerCommandError
-mono_debugger_server_get_pending_signal (ServerHandle *handle, guint32 *signal)
-{
- if (!global_vtable->get_pending_signal)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_pending_signal) (handle, signal);
-}
-
-ServerCommandError
-mono_debugger_server_kill (ServerHandle *handle)
-{
- return (* global_vtable->kill) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_get_signal_info (ServerHandle *handle, SignalInfo **sinfo)
-{
- *sinfo = NULL;
-
- if (!global_vtable->get_signal_info)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_signal_info) (handle, sinfo);
-
-}
-
-void
-mono_debugger_server_set_runtime_info (ServerHandle *handle, MonoRuntimeInfo *mono_runtime)
-{
- if (global_vtable->set_runtime_info)
- (* global_vtable->set_runtime_info) (handle, mono_runtime);
-}
-
-ServerCommandError
-mono_debugger_server_get_threads (ServerHandle *handle, guint32 *count, guint32 **threads)
-{
- if (!global_vtable->get_threads)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_threads) (handle, count, threads);
-}
-
-ServerCommandError
-mono_debugger_server_get_application (ServerHandle *handle, gchar **exe_file, gchar **cwd,
- guint32 *nargs, gchar ***cmdline_args)
-{
- if (!global_vtable->get_application)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_application) (handle, exe_file, cwd, nargs, cmdline_args);
-}
-
-ServerCommandError
-mono_debugger_server_detach_after_fork (ServerHandle *handle)
-{
- if (!global_vtable->detach_after_fork)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->detach_after_fork) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_push_registers (ServerHandle *handle, guint64 *new_rsp)
-{
- if (!global_vtable->push_registers)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->push_registers) (handle, new_rsp);
-}
-
-ServerCommandError
-mono_debugger_server_pop_registers (ServerHandle *handle)
-{
- if (!global_vtable->pop_registers)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->pop_registers) (handle);
-}
-
-ServerCommandError
-mono_debugger_server_get_callback_frame (ServerHandle *handle, guint64 stack_pointer,
- gboolean exact_match, CallbackInfo *info)
-{
- if (!global_vtable->get_callback_frame)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->get_callback_frame) (
- handle, stack_pointer, exact_match, info);
-}
-
-ServerCommandError
-mono_debugger_server_restart_notification (ServerHandle *handle)
-{
- if (!global_vtable->restart_notification)
- return COMMAND_ERROR_NOT_IMPLEMENTED;
-
- return (* global_vtable->restart_notification) (handle);
-}
-
-void
-mono_debugger_server_get_registers_from_core_file (guint64 *values, const guint8 *buffer)
-{
- (* global_vtable->get_registers_from_core_file) (values, buffer);
-}
diff --git a/sysdeps/server/server.h b/sysdeps/server/server.h
deleted file mode 100644
index 3a0fdd2..0000000
--- a/sysdeps/server/server.h
+++ /dev/null
@@ -1,728 +0,0 @@
-#ifndef __MONO_DEBUGGER_SERVER_H__
-#define __MONO_DEBUGGER_SERVER_H__
-
-#include <breakpoints.h>
-#include <signal.h>
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#ifdef __GNUC__
-#define MONO_ZERO_LEN_ARRAY 0
-#else
-#define MONO_ZERO_LEN_ARRAY 1
-#endif
-
-#define MONO_DEBUGGER_REMOTE_VERSION 1
-#define MONO_DEBUGGER_REMOTE_MAGIC 0x36885fe4
-
-/*
- * Keep in sync with TargetExceptionType in classes/TargetException.cs.
- */
-typedef enum {
- COMMAND_ERROR_NONE = 0,
- COMMAND_ERROR_UNKNOWN_ERROR,
- COMMAND_ERROR_INTERNAL_ERROR,
- COMMAND_ERROR_NO_TARGET,
- COMMAND_ERROR_ALREADY_HAVE_TARGET,
- COMMAND_ERROR_CANNOT_START_TARGET,
- COMMAND_ERROR_NOT_STOPPED,
- COMMAND_ERROR_ALREADY_STOPPED,
- COMMAND_ERROR_RECURSIVE_CALL,
- COMMAND_ERROR_NO_SUCH_BREAKPOINT,
- COMMAND_ERROR_NO_SUCH_REGISTER,
- COMMAND_ERROR_DR_OCCUPIED,
- COMMAND_ERROR_MEMORY_ACCESS,
- COMMAND_ERROR_NOT_IMPLEMENTED,
- COMMAND_ERROR_IO_ERROR,
- COMMAND_ERROR_NO_CALLBACK_FRAME,
- COMMAND_ERROR_PERMISSION_DENIED
-} ServerCommandError;
-
-typedef enum {
- MESSAGE_NONE,
- MESSAGE_UNKNOWN_ERROR = 1,
- MESSAGE_CHILD_EXITED = 2,
- MESSAGE_CHILD_STOPPED,
- MESSAGE_CHILD_SIGNALED,
- MESSAGE_CHILD_CALLBACK,
- MESSAGE_CHILD_CALLBACK_COMPLETED,
- MESSAGE_CHILD_HIT_BREAKPOINT,
- MESSAGE_CHILD_MEMORY_CHANGED,
- MESSAGE_CHILD_CREATED_THREAD,
- MESSAGE_CHILD_FORKED,
- MESSAGE_CHILD_EXECD,
- MESSAGE_CHILD_CALLED_EXIT,
- MESSAGE_CHILD_NOTIFICATION,
- MESSAGE_CHILD_INTERRUPTED,
- MESSAGE_RUNTIME_INVOKE_DONE,
- MESSAGE_INTERNAL_ERROR
-} ServerStatusMessageType;
-
-typedef struct {
- ServerStatusMessageType type;
- guint32 arg;
-} ServerStatusMessage;
-
-typedef struct {
- guint64 address;
- guint64 stack_pointer;
- guint64 frame_address;
-} StackFrame;
-
-typedef struct {
- guint64 callback_argument;
- guint64 call_address;
- guint64 stack_pointer;
- guint64 is_rti_frame : 1;
- guint64 is_exact_match : 1;
- guint64 saved_registers [MONO_ZERO_LEN_ARRAY];
-} CallbackInfo;
-
-#define EXECUTABLE_CODE_CHUNK_SIZE 16
-
-typedef struct
-{
- guint32 address_size;
- guint64 notification_address;
- guint64 executable_code_buffer;
- guint32 executable_code_buffer_size;
- guint32 executable_code_chunk_size;
- guint32 executable_code_total_chunks;
- guint64 breakpoint_info_area;
- guint64 breakpoint_table;
- guint32 breakpoint_table_size;
-
- /* Private */
- guint8 *breakpoint_table_bitfield;
- guint8 *executable_code_bitfield;
- guint32 executable_code_last_slot;
-} MonoRuntimeInfo;
-
-typedef enum {
- SERVER_CAPABILITIES_NONE = 0,
- SERVER_CAPABILITIES_THREAD_EVENTS = 1,
- SERVER_CAPABILITIES_CAN_DETACH_ANY = 2
-} ServerCapabilities;
-
-typedef enum {
- SERVER_TYPE_UNKNOWN = 0,
- SERVER_TYPE_LINUX_PTRACE = 1,
- SERVER_TYPE_DARWIN = 2,
- SERVER_TYPE_WIN32 = 3
-} ServerType;
-
-/* This is an opaque data structure which the backend may use to store stuff. */
-typedef struct InferiorVTable InferiorVTable;
-typedef struct InferiorHandle InferiorHandle;
-typedef struct ServerHandle ServerHandle;
-typedef struct ArchInfo ArchInfo;
-
-typedef struct IOThreadData IOThreadData;
-
-/* C# delegates. */
-typedef void (*ChildOutputFunc) (gboolean is_stderr, const char *output);
-
-typedef struct {
- int sigkill;
- int sigstop;
- int sigint;
- int sigchld;
- int sigfpe;
- int sigquit;
- int sigabrt;
- int sigsegv;
- int sigill;
- int sigbus;
- int sigwinch;
- int kernel_sigrtmin;
- int mono_thread_abort;
-} SignalInfo;
-
-/*
- * Server functions.
- *
- * When porting the debugger to another architecture, you need to implement all functions
- * in this vtable.
- *
- * It is a requirement that all functions always return immediately without blocking.
- * If the requested operation cannot be performed (for instance because the target is currently
- * running, don't wait for it but return an error condition!).
- */
-
-struct ServerHandle {
- ArchInfo *arch;
- InferiorHandle *inferior;
- MonoRuntimeInfo *mono_runtime;
- BreakpointManager *bpm;
-};
-
-struct InferiorVTable {
-
- void (* global_init) (void);
-
- ServerType (* get_server_type) (void);
-
- ServerCapabilities (* get_capabilities) (void);
-
- ServerHandle * (* create_inferior) (BreakpointManager *bpm);
-
- ServerCommandError (* initialize_process) (ServerHandle *handle);
-
- ServerCommandError (* initialize_thread) (ServerHandle *handle,
- guint32 pid,
- gboolean wait);
-
- void (* set_runtime_info) (ServerHandle *handle,
- MonoRuntimeInfo *mono_runtime_info);
-
- void (* io_thread_main) (IOThreadData *io_data,
- ChildOutputFunc func);
-
- ServerCommandError (* spawn) (ServerHandle *handle,
- const gchar *working_directory,
- const gchar **argv,
- const gchar **envp,
- gboolean redirect_fds,
- gint *child_pid,
- IOThreadData **io_data,
- gchar **error);
-
- ServerCommandError (* attach) (ServerHandle *handle,
- guint32 pid);
-
- ServerCommandError (* detach) (ServerHandle *handle);
-
- void (* finalize) (ServerHandle *handle);
-
- guint32 (* global_wait) (guint32 *status_ret);
-
- ServerCommandError (* stop_and_wait) (ServerHandle *handle,
- guint32 *status);
-
- ServerStatusMessageType (* dispatch_event) (ServerHandle *handle,
- guint32 status,
- guint64 *arg,
- guint64 *data1,
- guint64 *data2,
- guint32 *opt_data_size,
- gpointer *opt_data);
-
- ServerStatusMessageType (* dispatch_simple) (guint32 status,
- guint32 *arg);
-
- /* Get sizeof (int), sizeof (long) and sizeof (void *) from the target. */
- ServerCommandError (* get_target_info) (guint32 *target_int_size,
- guint32 *target_long_size,
- guint32 *target_address_size,
- guint32 *is_bigendian);
-
- /*
- * Continue the target.
- * This operation must start the target and then return immediately
- * (without waiting for the target to stop).
- */
- ServerCommandError (* run) (ServerHandle *handle);
-
- /*
- * Single-step one machine instruction.
- * This operation must start the target and then return immediately
- * (without waiting for the target to stop).
- */
- ServerCommandError (* step) (ServerHandle *handle);
-
- ServerCommandError (* resume) (ServerHandle *handle);
-
- /*
- * Get the current program counter.
- * Return COMMAND_ERROR_NOT_STOPPED if the target is currently running.
- * This is a time-critical function, it must return immediately without blocking.
- */
- ServerCommandError (* get_frame) (ServerHandle *handle,
- StackFrame *frame);
-
- /*
- * Checks whether the current instruction is a breakpoint.
- */
- ServerCommandError (* current_insn_is_bpt) (ServerHandle *handle,
- guint32 *is_breakpoint);
-
- ServerCommandError (* peek_word) (ServerHandle *handle,
- guint64 start,
- guint64 *word);
-
- /*
- * Read `size' bytes from the target's address space starting at `start'.
- * Writes the result into `buffer' (which has been allocated by the caller).
- */
- ServerCommandError (* read_memory) (ServerHandle *handle,
- guint64 start,
- guint32 size,
- gpointer buffer);
-
- /*
- * Write `size' bytes from `buffer' to the target's address space starting at `start'.
- */
- ServerCommandError (* write_memory) (ServerHandle *handle,
- guint64 start,
- guint32 size,
- gconstpointer data);
-
- /*
- * Call `guint64 (*func) (guint64)' function at address `method' in the target address
- * space, pass it argument `method_argument', send a MESSAGE_CHILD_CALLBACK with the
- * `callback_argument' and the function's return value when the function returns.
- * This function must return immediately without waiting for the target !
- */
- ServerCommandError (* call_method) (ServerHandle *handle,
- guint64 method,
- guint64 method_argument1,
- guint64 method_argument2,
- guint64 callback_argument);
-
- /*
- * Call `guint64 (*func) (guint64, const gchar *)' function at address `method' in the
- * target address space, pass it arguments `method_argument' and `string_argument' , send
- * a MESSAGE_CHILD_CALLBACK with the `callback_argument' and the function's return value
- * when the function returns.
- * This function must return immediately without waiting for the target !
- */
- ServerCommandError (* call_method_1) (ServerHandle *handle,
- guint64 method,
- guint64 method_argument,
- guint64 data_argument,
- guint64 data_argument2,
- const gchar *string_argument,
- guint64 callback_argument);
-
- ServerCommandError (* call_method_2) (ServerHandle *handle,
- guint64 method,
- guint32 data_size,
- gconstpointer data_buffer,
- guint64 callback_argument);
-
- ServerCommandError (* call_method_3) (ServerHandle *handle,
- guint64 method_address,
- guint64 method_argument,
- guint64 address_argument,
- guint32 blob_size,
- gconstpointer blob_data,
- guint64 callback_argument);
-
- ServerCommandError (* call_method_invoke) (ServerHandle *handle,
- guint64 invoke_method,
- guint64 method_argument,
- guint32 num_params,
- guint32 glob_size,
- guint64 *param_data,
- gint32 *offset_data,
- gconstpointer blob_data,
- guint64 callback_argument,
- gboolean debug);
-
- ServerCommandError (* execute_instruction) (ServerHandle *handle,
- const guint8 *instruction,
- guint32 size,
- gboolean update_ip);
-
- ServerCommandError (* mark_rti_frame) (ServerHandle *handle);
-
- ServerCommandError (* abort_invoke) (ServerHandle *handle,
- guint64 rti_id);
-
- /*
- * Insert a breakpoint at address `address' in the target's address space.
- * Returns a breakpoint handle in `bhandle' which can be passed to `remove_breakpoint'
- * to remove the breakpoint.
- */
- ServerCommandError (* insert_breakpoint) (ServerHandle *handle,
- guint64 address,
- guint32 *bhandle);
-
- /*
- * Insert a hardware breakpoint at address `address' in the target's address space.
- * Returns a breakpoint handle in `bhandle' which can be passed to `remove_breakpoint'
- * to remove the breakpoint.
- */
- ServerCommandError (* insert_hw_breakpoint)(ServerHandle *handle,
- guint32 type,
- guint32 *idx,
- guint64 address,
- guint32 *bhandle);
-
- /*
- * Remove breakpoint `bhandle'.
- */
- ServerCommandError (* remove_breakpoint) (ServerHandle *handle,
- guint32 bhandle);
-
- /*
- * Enables breakpoint `bhandle'.
- */
- ServerCommandError (* enable_breakpoint) (ServerHandle *handle,
- guint32 bhandle);
-
- /*
- * Disables breakpoint `bhandle'.
- */
- ServerCommandError (* disable_breakpoint) (ServerHandle *handle,
- guint32 bhandle);
-
- /*
- * Get all breakpoints. Writes number of breakpoints into `count' and returns a g_new0()
- * allocated list of guint32's in `breakpoints'. The caller is responsible for freeing this
- * data structure.
- */
- ServerCommandError (* get_breakpoints) (ServerHandle *handle,
- guint32 *count,
- guint32 **breakpoints);
-
- /*
- * Get processor registers.
- *
- */
- ServerCommandError (* get_registers) (ServerHandle *handle,
- guint64 *values);
-
- /*
- * Set processor registers.
- *
- */
- ServerCommandError (* set_registers) (ServerHandle *handle,
- guint64 *values);
-
- /*
- * Stop the target.
- */
- ServerCommandError (* stop) (ServerHandle *handle);
-
- /*
- * Send signal `sig' to the target the next time it is continued.
- */
- ServerCommandError (* set_signal) (ServerHandle *handle,
- guint32 sig,
- guint32 send_it);
-
- ServerCommandError (* get_pending_signal) (ServerHandle *handle,
- guint32 *signal);
-
- /*
- * Kill the target.
- */
- ServerCommandError (* kill) (ServerHandle *handle);
-
- ServerCommandError (* get_signal_info) (ServerHandle *handle,
- SignalInfo **sinfo);
-
- ServerCommandError (* get_threads) (ServerHandle *handle,
- guint32 *count,
- guint32 **threads);
-
- ServerCommandError (* get_application) (ServerHandle *handle,
- gchar **exe_file,
- gchar **cwd,
- guint32 *nargs,
- gchar ***cmdline_args);
-
- ServerCommandError (* detach_after_fork) (ServerHandle *handle);
-
- ServerCommandError (* push_registers) (ServerHandle *handle,
- guint64 *new_rsp);
-
- ServerCommandError (* pop_registers) (ServerHandle *handle);
-
- ServerCommandError (* get_callback_frame) (ServerHandle *handle,
- guint64 stack_pointer,
- gboolean exact_match,
- CallbackInfo *info);
-
- ServerCommandError (* restart_notification) (ServerHandle *handle);
-
- void (* get_registers_from_core_file) (guint64 *values,
- const guint8 *buffer);
-
- guint32 (*get_current_pid) (void);
-
- guint64 (*get_current_thread) (void);
-};
-
-/*
- * Library functions.
- *
- * These functions just call the corresponding function in the ServerHandle's vtable.
- * They're just here to be called from C#.
- */
-
-void
-mono_debugger_server_global_init (void);
-
-ServerCapabilities
-mono_debugger_server_get_capabilities (void);
-
-ServerType
-mono_debugger_server_get_server_type (void);
-
-ServerHandle *
-mono_debugger_server_create_inferior (BreakpointManager *bpm);
-
-ServerCommandError
-mono_debugger_server_initialize_process (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_initialize_thread (ServerHandle *handle,
- guint32 pid,
- gboolean wait);
-
-void
-mono_debugger_server_io_thread_main (IOThreadData *io_data,
- ChildOutputFunc func);
-
-ServerCommandError
-mono_debugger_server_spawn (ServerHandle *handle,
- const gchar *working_directory,
- const gchar **argv,
- const gchar **envp,
- gboolean redirect_fds,
- gint *child_pid,
- IOThreadData **io_data,
- gchar **error);
-
-ServerCommandError
-mono_debugger_server_attach (ServerHandle *handle,
- guint32 pid);
-
-void
-mono_debugger_server_finalize (ServerHandle *handle);
-
-guint32
-mono_debugger_server_global_wait (guint32 *status);
-
-ServerStatusMessageType
-mono_debugger_server_dispatch_event (ServerHandle *handle,
- guint32 status,
- guint64 *arg,
- guint64 *data1,
- guint64 *data2,
- guint32 *opt_data_size,
- gpointer *opt_data);
-
-ServerCommandError
-mono_debugger_server_get_target_info (guint32 *target_int_size,
- guint32 *target_long_size,
- guint32 *target_address_size,
- guint32 *is_bigendian);
-
-ServerCommandError
-mono_debugger_server_get_frame (ServerHandle *handle,
- StackFrame *frame);
-
-ServerCommandError
-mono_debugger_server_current_insn_is_bpt (ServerHandle *handle,
- guint32 *is_breakpoint);
-
-ServerCommandError
-mono_debugger_server_step (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_continue (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_resume (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_detach (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_peek_word (ServerHandle *handle,
- guint64 start,
- guint64 *word);
-
-ServerCommandError
-mono_debugger_server_read_memory (ServerHandle *handle,
- guint64 start,
- guint32 size,
- gpointer data);
-
-ServerCommandError
-mono_debugger_server_write_memory (ServerHandle *handle,
- guint64 start,
- guint32 size,
- gconstpointer data);
-
-ServerCommandError
-mono_debugger_server_call_method (ServerHandle *handle,
- guint64 method_address,
- guint64 method_argument1,
- guint64 method_argument2,
- guint64 callback_argument);
-
-ServerCommandError
-mono_debugger_server_call_method_1 (ServerHandle *handle,
- guint64 method_address,
- guint64 method_argument,
- guint64 data_argument,
- guint64 data_argument2,
- const gchar *string_argument,
- guint64 callback_argument);
-
-ServerCommandError
-mono_debugger_server_call_method_2 (ServerHandle *handle,
- guint64 method_address,
- guint32 data_size,
- gconstpointer data_buffer,
- guint64 callback_argument);
-
-ServerCommandError
-mono_debugger_server_call_method_3 (ServerHandle *handle,
- guint64 method_address,
- guint64 method_argument,
- guint64 address_argument,
- guint32 blob_size,
- gconstpointer blob_data,
- guint64 callback_argument);
-
-ServerCommandError
-mono_debugger_server_call_method_invoke (ServerHandle *handle,
- guint64 invoke_method,
- guint64 method_argument,
- guint32 num_params,
- guint32 blob_size,
- guint64 *param_data,
- gint32 *offset_data,
- gconstpointer blob_data,
- guint64 callback_argument,
- gboolean debug);
-
-ServerCommandError
-mono_debugger_execute_instruction (ServerHandle *handle,
- const guint8 *instruction,
- guint32 instruction_size,
- gboolean update_ip);
-
-ServerCommandError
-mono_debugger_mark_rti_framenvoke (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_abort_invoke (ServerHandle *handle,
- guint64 rti_id);
-
-ServerCommandError
-mono_debugger_server_insert_breakpoint (ServerHandle *handle,
- guint64 address,
- guint32 *breakpoint);
-
-ServerCommandError
-mono_debugger_server_insert_hw_breakpoint(ServerHandle *handle,
- guint32 type,
- guint32 *idx,
- guint64 address,
- guint32 *breakpoint);
-
-ServerCommandError
-mono_debugger_server_remove_breakpoint (ServerHandle *handle,
- guint32 breakpoint);
-
-ServerCommandError
-mono_debugger_server_enable_breakpoint (ServerHandle *handle,
- guint32 breakpoint);
-
-ServerCommandError
-mono_debugger_server_disable_breakpoint (ServerHandle *handle,
- guint32 breakpoint);
-
-ServerCommandError
-mono_debugger_server_get_registers (ServerHandle *handle,
- guint64 *values);
-
-ServerCommandError
-mono_debugger_server_set_registers (ServerHandle *handle,
- guint64 *values);
-
-ServerCommandError
-mono_debugger_server_stop (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_stop_and_wait (ServerHandle *handle,
- guint32 *status);
-
-ServerCommandError
-mono_debugger_server_set_signal (ServerHandle *handle,
- guint32 sig,
- guint32 send_it);
-
-ServerCommandError
-mono_debugger_server_get_pending_signal (ServerHandle *handle,
- guint32 *signal);
-
-ServerCommandError
-mono_debugger_server_kill (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_get_signal_info (ServerHandle *handle,
- SignalInfo **sinfo);
-
-void
-mono_debugger_server_set_runtime_info (ServerHandle *handle,
- MonoRuntimeInfo *mono_runtime);
-
-ServerCommandError
-mono_debugger_server_get_threads (ServerHandle *handle,
- guint32 *count,
- guint32 **threads);
-
-ServerCommandError
-mono_debugger_server_get_application (ServerHandle *handle,
- gchar **exe_file,
- gchar **cwd,
- guint32 *nargs,
- gchar ***cmdline_args);
-
-ServerCommandError
-mono_debugger_server_detach_after_fork (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_push_registers (ServerHandle *handle,
- guint64 *new_rsp);
-
-ServerCommandError
-mono_debugger_server_pop_registers (ServerHandle *handle);
-
-ServerCommandError
-mono_debugger_server_get_callback_frame (ServerHandle *handle,
- guint64 stack_pointer,
- gboolean exact_match,
- CallbackInfo *info);
-
-ServerCommandError
-mono_debugger_server_restart_notification (ServerHandle *handle);
-
-MonoRuntimeInfo *
-mono_debugger_server_initialize_mono_runtime (guint32 address_size,
- guint64 notification_address,
- guint64 executable_code_buffer,
- guint32 executable_code_buffer_size,
- guint64 breakpoint_info_area,
- guint64 breakpoint_table,
- guint32 breakpoint_table_size);
-
-void
-mono_debugger_server_finalize_mono_runtime (MonoRuntimeInfo *runtime);
-
-void
-mono_debugger_server_initialize_code_buffer (MonoRuntimeInfo *runtime,
- guint64 executable_code_buffer,
- guint32 executable_code_buffer_size);
-
-void
-mono_debugger_server_get_registers_from_core_file (guint64 *values,
- const guint8 *buffer);
-
-guint32
-mono_debugger_server_get_current_pid (void);
-
-guint64
-mono_debugger_server_get_current_thread (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sysdeps/server/x86-linux-ptrace.c b/sysdeps/server/x86-linux-ptrace.c
deleted file mode 100644
index 2c8379c..0000000
--- a/sysdeps/server/x86-linux-ptrace.c
+++ /dev/null
@@ -1,695 +0,0 @@
-static ServerType
-server_ptrace_get_server_type (void)
-{
- return SERVER_TYPE_LINUX_PTRACE;
-}
-
-static ServerCapabilities
-server_ptrace_get_capabilities (void)
-{
- return SERVER_CAPABILITIES_THREAD_EVENTS | SERVER_CAPABILITIES_CAN_DETACH_ANY;
-}
-
-static ServerCommandError
-_server_ptrace_check_errno (InferiorHandle *inferior)
-{
- gchar *filename;
-
- if (!errno)
- return COMMAND_ERROR_NONE;
- else if (errno != ESRCH) {
- g_message (G_STRLOC ": %d - %s", inferior->pid, g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- filename = g_strdup_printf ("/proc/%d/stat", inferior->pid);
- if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
- g_free (filename);
- return COMMAND_ERROR_NOT_STOPPED;
- }
-
- g_warning (G_STRLOC ": %d - %s - %d (%s)", inferior->pid, filename,
- errno, g_strerror (errno));
- g_free (filename);
- return COMMAND_ERROR_NO_TARGET;
-}
-
-static ServerCommandError
-_server_ptrace_make_memory_executable (ServerHandle *handle, guint64 start, guint32 size)
-{
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_get_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs)
-{
- if (ptrace (PT_GETREGS, inferior->pid, NULL, regs) != 0)
- return _server_ptrace_check_errno (inferior);
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_set_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs)
-{
- if (ptrace (PT_SETREGS, inferior->pid, NULL, regs) != 0)
- return _server_ptrace_check_errno (inferior);
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_get_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs)
-{
- if (ptrace (PT_GETFPREGS, inferior->pid, NULL, regs) != 0)
- return _server_ptrace_check_errno (inferior);
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_set_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs)
-{
- if (ptrace (PT_SETFPREGS, inferior->pid, NULL, regs) != 0)
- return _server_ptrace_check_errno (inferior);
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer buffer)
-{
- guint8 *ptr = buffer;
- guint32 old_size = size;
-
- while (size) {
- int ret = pread64 (handle->inferior->os.mem_fd, ptr, size, start);
- if (ret < 0) {
- if (errno == EINTR)
- continue;
- else if (errno == ESRCH)
- return COMMAND_ERROR_NOT_STOPPED;
- else if (errno == EIO)
- return COMMAND_ERROR_MEMORY_ACCESS;
- return COMMAND_ERROR_MEMORY_ACCESS;
- }
-
- size -= ret;
- ptr += ret;
- }
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer buffer)
-{
- ServerCommandError result = _server_ptrace_read_memory (handle, start, size, buffer);
- if (result != COMMAND_ERROR_NONE)
- return result;
- x86_arch_remove_breakpoints_from_target_memory (handle, start, size, buffer);
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_write_memory (ServerHandle *handle, guint64 start,
- guint32 size, gconstpointer buffer)
-{
- InferiorHandle *inferior = handle->inferior;
- ServerCommandError result;
- const long *ptr = buffer;
- guint64 addr = start;
- char temp [8];
-
- while (size >= sizeof (long)) {
- long word = *ptr++;
-
- errno = 0;
- if (ptrace (PT_WRITE_D, inferior->pid, GSIZE_TO_POINTER (addr), word) != 0)
- return _server_ptrace_check_errno (inferior);
-
- addr += sizeof (long);
- size -= sizeof (long);
- }
-
- if (!size)
- return COMMAND_ERROR_NONE;
-
- result = _server_ptrace_read_memory (handle, addr, sizeof (long), &temp);
- if (result != COMMAND_ERROR_NONE)
- return result;
-
- memcpy (&temp, ptr, size);
-
- return server_ptrace_write_memory (handle, addr, sizeof (long), &temp);
-}
-
-static ServerCommandError
-server_ptrace_poke_word (ServerHandle *handle, guint64 addr, gsize value)
-{
- errno = 0;
- if (ptrace (PT_WRITE_D, handle->inferior->pid, GSIZE_TO_POINTER (addr), value) != 0)
- return _server_ptrace_check_errno (handle->inferior);
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_set_dr (InferiorHandle *handle, int regnum, guint64 value)
-{
- errno = 0;
- ptrace (PTRACE_POKEUSER, handle->pid, offsetof (struct user, u_debugreg [regnum]), value);
- if (errno) {
- g_message (G_STRLOC ": %d - %d - %s", handle->pid, regnum, g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- return COMMAND_ERROR_NONE;
-}
-
-
-static ServerCommandError
-_server_ptrace_get_dr (InferiorHandle *handle, int regnum, guint64 *value)
-{
- int ret;
-
- errno = 0;
- ret = ptrace (PTRACE_PEEKUSER, handle->pid, offsetof (struct user, u_debugreg [regnum]));
- if (errno) {
- g_message (G_STRLOC ": %d - %d - %s", handle->pid, regnum, g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- *value = ret;
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_continue (ServerHandle *handle)
-{
- InferiorHandle *inferior = handle->inferior;
-
- errno = 0;
- inferior->stepping = FALSE;
- if (ptrace (PT_CONTINUE, inferior->pid, (caddr_t) 1, inferior->last_signal)) {
- return _server_ptrace_check_errno (inferior);
- }
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_step (ServerHandle *handle)
-{
- InferiorHandle *inferior = handle->inferior;
-
- errno = 0;
- inferior->stepping = TRUE;
- if (ptrace (PT_STEP, inferior->pid, (caddr_t) 1, inferior->last_signal))
- return _server_ptrace_check_errno (inferior);
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_kill (ServerHandle *handle)
-{
- if (ptrace (PTRACE_KILL, handle->inferior->pid, NULL, 0))
- return COMMAND_ERROR_UNKNOWN_ERROR;
-
- return COMMAND_ERROR_NONE;
-}
-
-GStaticMutex wait_mutex = G_STATIC_MUTEX_INIT;
-GStaticMutex wait_mutex_2 = G_STATIC_MUTEX_INIT;
-GStaticMutex wait_mutex_3 = G_STATIC_MUTEX_INIT;
-
-static int
-do_wait (int pid, guint32 *status, gboolean nohang)
-{
- int ret, flags;
-
-#if DEBUG_WAIT
- g_message (G_STRLOC ": do_wait (%d%s)", pid, nohang ? ",nohang" : "");
-#endif
- flags = WUNTRACED | __WALL | __WCLONE;
- if (nohang)
- flags |= WNOHANG;
- ret = waitpid (pid, status, flags);
-#if DEBUG_WAIT
- g_message (G_STRLOC ": do_wait (%d) finished: %d - %x", pid, ret, *status);
-#endif
- if (ret < 0) {
- if (errno == EINTR)
- return 0;
- else if (errno == ECHILD)
- return -1;
- g_warning (G_STRLOC ": Can't waitpid for %d: %s", pid, g_strerror (errno));
- return -1;
- }
-
- return ret;
-}
-
-static int stop_requested = 0;
-static int stop_status = 0;
-
-static guint32
-server_ptrace_global_wait (guint32 *status_ret)
-{
- int ret, status;
-
- again:
- g_static_mutex_lock (&wait_mutex);
- ret = do_wait (-1, &status, FALSE);
- if (ret <= 0)
- goto out;
-
-#if DEBUG_WAIT
- g_message (G_STRLOC ": global wait finished: %d - %x", ret, status);
-#endif
-
- g_static_mutex_lock (&wait_mutex_2);
-
-#if DEBUG_WAIT
- g_message (G_STRLOC ": global wait finished #1: %d - %x - %d",
- ret, status, stop_requested);
-#endif
-
- if (ret == stop_requested) {
- *status_ret = 0;
- stop_status = status;
- g_static_mutex_unlock (&wait_mutex_2);
- g_static_mutex_unlock (&wait_mutex);
-
- g_static_mutex_lock (&wait_mutex_3);
- g_static_mutex_unlock (&wait_mutex_3);
- goto again;
- }
- g_static_mutex_unlock (&wait_mutex_2);
-
- *status_ret = status;
- out:
- g_static_mutex_unlock (&wait_mutex);
- return ret;
-}
-
-static gboolean
-_server_ptrace_wait_for_new_thread (ServerHandle *handle)
-{
- guint32 ret, status = 0;
-
- /*
- * There is a race condition in the Linux kernel which shows up on >= 2.6.27:
- *
- * When creating a new thread, the initial stopping event of that thread is sometimes
- * sent before sending the `PTRACE_EVENT_CLONE' for it.
- *
- * Because of this, we wait here until the new thread has been stopped and ignore
- * any "early" stopping events.
- *
- * See also bugs #423518 and #466012.
-. *
- */
-
- if (!g_static_mutex_trylock (&wait_mutex)) {
- /* This should never happen, but let's not deadlock here. */
- g_warning (G_STRLOC ": Can't lock mutex: %d", handle->inferior->pid);
- return FALSE;
- }
-
- /*
- * We own the `wait_mutex', so no other thread is currently waiting for the target
- * and we can safely wait for it here.
- */
-
- ret = waitpid (handle->inferior->pid, &status, WUNTRACED | __WALL | __WCLONE);
-
- /*
- * Safety check: make sure we got the correct event.
- */
-
- if ((ret != handle->inferior->pid) || !WIFSTOPPED (status) ||
- ((WSTOPSIG (status) != SIGSTOP) && (WSTOPSIG (status) != SIGTRAP))) {
- g_warning (G_STRLOC ": Wait failed: %d, got pid %d, status %x", handle->inferior->pid, ret, status);
- g_static_mutex_unlock (&wait_mutex);
- return FALSE;
- }
-
- /*
- * Just as an extra safety check.
- */
-
- if (x86_arch_get_registers (handle) != COMMAND_ERROR_NONE) {
- g_static_mutex_unlock (&wait_mutex);
- g_warning (G_STRLOC ": Failed to get registers: %d", handle->inferior->pid);
- return FALSE;
- }
-
- g_static_mutex_unlock (&wait_mutex);
- return TRUE;
-}
-
-static ServerCommandError
-server_ptrace_stop (ServerHandle *handle)
-{
- ServerCommandError result;
-
- /*
- * Try to get the thread's registers. If we suceed, then it's already stopped
- * and still alive.
- */
- result = x86_arch_get_registers (handle);
- if (result == COMMAND_ERROR_NONE)
- return COMMAND_ERROR_ALREADY_STOPPED;
-
- if (syscall (__NR_tkill, handle->inferior->pid, SIGSTOP)) {
- /*
- * It's already dead.
- */
- if (errno == ESRCH)
- return COMMAND_ERROR_NO_TARGET;
- else
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_stop_and_wait (ServerHandle *handle, guint32 *status)
-{
- ServerCommandError result;
- gboolean already_stopped = FALSE;
- int ret;
-
- /*
- * Try to get the thread's registers. If we suceed, then it's already stopped
- * and still alive.
- */
-#if DEBUG_WAIT
- g_message (G_STRLOC ": stop and wait %d", handle->inferior->pid);
-#endif
- g_static_mutex_lock (&wait_mutex_2);
- result = server_ptrace_stop (handle);
- if (result == COMMAND_ERROR_ALREADY_STOPPED) {
-#if DEBUG_WAIT
- g_message (G_STRLOC ": %d - already stopped", handle->inferior->pid);
-#endif
- already_stopped = TRUE;
- } else if (result != COMMAND_ERROR_NONE) {
-#if DEBUG_WAIT
- g_message (G_STRLOC ": %d - cannot stop %d", handle->inferior->pid, result);
-#endif
-
- g_static_mutex_unlock (&wait_mutex_2);
- return result;
- }
-
- g_static_mutex_lock (&wait_mutex_3);
-
- stop_requested = handle->inferior->pid;
- g_static_mutex_unlock (&wait_mutex_2);
-
-#if DEBUG_WAIT
- if (!already_stopped)
- g_message (G_STRLOC ": %d - sent SIGSTOP", handle->inferior->pid);
-#endif
-
- g_static_mutex_lock (&wait_mutex);
-#if DEBUG_WAIT
- g_message (G_STRLOC ": %d - got stop status %x", handle->inferior->pid, stop_status);
-#endif
- if (stop_status) {
- *status = stop_status;
- stop_requested = stop_status = 0;
- g_static_mutex_unlock (&wait_mutex);
- g_static_mutex_unlock (&wait_mutex_3);
- return COMMAND_ERROR_NONE;
- }
-
- stop_requested = stop_status = 0;
-
- do {
-#if DEBUG_WAIT
- g_message (G_STRLOC ": %d - waiting", handle->inferior->pid);
-#endif
- ret = do_wait (handle->inferior->pid, status, already_stopped);
-#if DEBUG_WAIT
- g_message (G_STRLOC ": %d - done waiting %d, %x",
- handle->inferior->pid, ret, status);
-#endif
- } while (ret == 0);
- g_static_mutex_unlock (&wait_mutex);
- g_static_mutex_unlock (&wait_mutex_3);
-
- /*
- * Should never happen.
- */
- if (ret < 0)
- return COMMAND_ERROR_NO_TARGET;
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-_server_ptrace_setup_inferior (ServerHandle *handle)
-{
- gchar *filename = g_strdup_printf ("/proc/%d/mem", handle->inferior->pid);
-
- x86_arch_remove_hardware_breakpoints (handle);
-
- handle->inferior->os.mem_fd = open64 (filename, O_RDONLY);
-
- if (handle->inferior->os.mem_fd < 0) {
- if (errno == EACCES)
- return COMMAND_ERROR_PERMISSION_DENIED;
-
- g_warning (G_STRLOC ": Can't open (%s): %s", filename, g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- g_free (filename);
- return COMMAND_ERROR_NONE;
-}
-
-static void
-_server_ptrace_finalize_inferior (ServerHandle *handle)
-{
- close (handle->inferior->os.mem_fd);
- handle->inferior->os.mem_fd = -1;
-}
-
-static ServerCommandError
-server_ptrace_initialize_process (ServerHandle *handle)
-{
- int flags = PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK |
- PTRACE_O_TRACEEXEC;
-
- if (ptrace (PTRACE_SETOPTIONS, handle->inferior->pid, 0, flags)) {
- g_warning (G_STRLOC ": Can't PTRACE_SETOPTIONS %d: %s",
- handle->inferior->pid, g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_get_signal_info (ServerHandle *handle, SignalInfo **sinfo_out)
-{
- SignalInfo *sinfo = g_new0 (SignalInfo, 1);
-
- sinfo->sigkill = SIGKILL;
- sinfo->sigstop = SIGSTOP;
- sinfo->sigint = SIGINT;
- sinfo->sigchld = SIGCHLD;
-
- sinfo->sigfpe = SIGFPE;
- sinfo->sigquit = SIGQUIT;
- sinfo->sigabrt = SIGABRT;
- sinfo->sigsegv = SIGSEGV;
- sinfo->sigill = SIGILL;
- sinfo->sigbus = SIGBUS;
- sinfo->sigwinch = SIGWINCH;
-
- /* __SIGRTMIN is the hard limit from the kernel, SIGRTMIN is the first
- * user-visible real-time signal. __SIGRTMIN and __SIGRTMIN+1 are used
- * internally by glibc. */
- sinfo->kernel_sigrtmin = __SIGRTMIN;
-#ifdef USING_MONO_FROM_TRUNK
- sinfo->mono_thread_abort = -1;
-#else
- sinfo->mono_thread_abort = mono_thread_get_abort_signal ();
-#endif
-
- *sinfo_out = sinfo;
-
- return COMMAND_ERROR_NONE;
-}
-
-static void
-server_ptrace_global_init (void)
-{
- stop_requested = 0;
- stop_status = 0;
-}
-
-static ServerCommandError
-server_ptrace_get_threads (ServerHandle *handle, guint32 *count, guint32 **threads)
-{
- gchar *dirname = g_strdup_printf ("/proc/%d/task", handle->inferior->pid);
- const gchar *filename;
- GPtrArray *array;
- GDir *dir;
- int i;
-
- dir = g_dir_open (dirname, 0, NULL);
- if (!dir) {
- g_warning (G_STRLOC ": Can't get threads of %d", handle->inferior->pid);
- g_free (dirname);
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- array = g_ptr_array_new ();
-
- while ((filename = g_dir_read_name (dir)) != NULL) {
- gchar *endptr;
- guint32 pid;
-
- pid = (guint32) strtol (filename, &endptr, 10);
- if (*endptr)
- goto out_error;
-
- g_ptr_array_add (array, GUINT_TO_POINTER (pid));
- }
-
- *count = array->len;
- *threads = g_new0 (guint32, array->len);
-
- for (i = 0; i < array->len; i++)
- (*threads) [i] = GPOINTER_TO_UINT (g_ptr_array_index (array, i));
-
- g_free (dirname);
- g_dir_close (dir);
- g_ptr_array_free (array, FALSE);
- return COMMAND_ERROR_NONE;
-
- out_error:
- g_free (dirname);
- g_dir_close (dir);
- g_ptr_array_free (array, FALSE);
- g_warning (G_STRLOC ": Can't get threads of %d", handle->inferior->pid);
- return COMMAND_ERROR_UNKNOWN_ERROR;
-}
-
-static ServerCommandError
-server_ptrace_get_application (ServerHandle *handle, gchar **exe_file, gchar **cwd,
- guint32 *nargs, gchar ***cmdline_args)
-{
- gchar *exe_filename = g_strdup_printf ("/proc/%d/exe", handle->inferior->pid);
- gchar *cwd_filename = g_strdup_printf ("/proc/%d/cwd", handle->inferior->pid);
- gchar *cmdline_filename = g_strdup_printf ("/proc/%d/cmdline", handle->inferior->pid);
- char buffer [BUFSIZ+1];
- GPtrArray *array;
- gchar *cmdline, **ptr;
- gssize pos, len;
- int i;
-
- len = readlink (exe_filename, buffer, BUFSIZ);
- if (len < 0) {
- g_free (cwd_filename);
- g_free (exe_filename);
- g_free (cmdline_filename);
-
- if (errno == EACCES)
- return COMMAND_ERROR_PERMISSION_DENIED;
-
- g_warning (G_STRLOC ": Can't get exe file of %d: %s", handle->inferior->pid,
- g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- buffer [len] = 0;
- *exe_file = g_strdup (buffer);
-
- len = readlink (cwd_filename, buffer, BUFSIZ);
- if (len < 0) {
- g_free (cwd_filename);
- g_free (exe_filename);
- g_free (cmdline_filename);
- g_warning (G_STRLOC ": Can't get cwd of %d: %s", handle->inferior->pid,
- g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- buffer [len] = 0;
- *cwd = g_strdup (buffer);
-
- if (!g_file_get_contents (cmdline_filename, &cmdline, &len, NULL)) {
- g_free (cwd_filename);
- g_free (exe_filename);
- g_free (cmdline_filename);
- g_warning (G_STRLOC ": Can't get cmdline args of %d", handle->inferior->pid);
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- array = g_ptr_array_new ();
-
- pos = 0;
- while (pos < len) {
- g_ptr_array_add (array, cmdline + pos);
- pos += strlen (cmdline + pos) + 1;
- }
-
- *nargs = array->len;
- *cmdline_args = ptr = g_new0 (gchar *, array->len + 1);
-
- for (i = 0; i < array->len; i++)
- ptr [i] = g_ptr_array_index (array, i);
-
- g_free (cwd_filename);
- g_free (exe_filename);
- g_free (cmdline_filename);
- g_ptr_array_free (array, FALSE);
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_detach_after_fork (ServerHandle *handle)
-{
- ServerCommandError result;
- GPtrArray *breakpoints;
- guint32 status;
- int ret, i;
-
- ret = waitpid (handle->inferior->pid, &status, WUNTRACED | WNOHANG | __WALL | __WCLONE);
- if (ret < 0)
- g_warning (G_STRLOC ": Can't waitpid for %d: %s", handle->inferior->pid, g_strerror (errno));
-
- /*
- * Make sure we're stopped.
- */
- if (x86_arch_get_registers (handle) != COMMAND_ERROR_NONE)
- do_wait (handle->inferior->pid, &status, FALSE);
-
- result = x86_arch_get_registers (handle);
- if (result != COMMAND_ERROR_NONE)
- return result;
-
- mono_debugger_breakpoint_manager_lock ();
-
- breakpoints = mono_debugger_breakpoint_manager_get_breakpoints (handle->bpm);
- for (i = 0; i < breakpoints->len; i++) {
- BreakpointInfo *info = g_ptr_array_index (breakpoints, i);
-
- x86_arch_disable_breakpoint (handle, info);
- }
-
- mono_debugger_breakpoint_manager_unlock ();
-
- if (ptrace (PT_DETACH, handle->inferior->pid, NULL, NULL) != 0)
- return _server_ptrace_check_errno (handle->inferior);
-
- return COMMAND_ERROR_NONE;
-}
diff --git a/sysdeps/server/x86-ptrace.c b/sysdeps/server/x86-ptrace.c
deleted file mode 100644
index 818eb36..0000000
--- a/sysdeps/server/x86-ptrace.c
+++ /dev/null
@@ -1,657 +0,0 @@
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <config.h>
-#include <server.h>
-#include <breakpoints.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <sys/stat.h>
-#include <sys/ptrace.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
-#include <sys/select.h>
-#include <sys/resource.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-
-/*
- * NOTE: The manpage is wrong about the POKE_* commands - the last argument
- * is the data (a word) to be written, not a pointer to it.
- *
- * In general, the ptrace(2) manpage is very bad, you should really read
- * kernel/ptrace.c and arch/i386/kernel/ptrace.c in the Linux source code
- * to get a better understanding for this stuff.
- */
-
-#ifdef __linux__
-#include "x86-linux-ptrace.h"
-#endif
-
-#ifdef __FreeBSD__
-#include "x86-freebsd-ptrace.h"
-#endif
-
-#ifdef __MACH__
-#include "darwin-ptrace.h"
-#endif
-
-#include "x86-arch.h"
-
-struct IOThreadData
-{
- int output_fd, error_fd;
-};
-
-MonoRuntimeInfo *
-mono_debugger_server_initialize_mono_runtime (guint32 address_size,
- guint64 notification_address,
- guint64 executable_code_buffer,
- guint32 executable_code_buffer_size,
- guint64 breakpoint_info_area,
- guint64 breakpoint_table,
- guint32 breakpoint_table_size)
-{
- MonoRuntimeInfo *runtime = g_new0 (MonoRuntimeInfo, 1);
-
- runtime->address_size = address_size;
- runtime->notification_address = notification_address;
- runtime->executable_code_buffer = executable_code_buffer;
- runtime->executable_code_buffer_size = executable_code_buffer_size;
- runtime->executable_code_chunk_size = EXECUTABLE_CODE_CHUNK_SIZE;
- runtime->executable_code_total_chunks = executable_code_buffer_size / EXECUTABLE_CODE_CHUNK_SIZE;
-
- runtime->breakpoint_info_area = breakpoint_info_area;
- runtime->breakpoint_table = breakpoint_table;
- runtime->breakpoint_table_size = breakpoint_table_size;
-
- runtime->breakpoint_table_bitfield = g_malloc0 (breakpoint_table_size);
- runtime->executable_code_bitfield = g_malloc0 (runtime->executable_code_total_chunks);
-
- return runtime;
-}
-
-void
-mono_debugger_server_initialize_code_buffer (MonoRuntimeInfo *runtime,
- guint64 executable_code_buffer,
- guint32 executable_code_buffer_size)
-{
- runtime->executable_code_buffer = executable_code_buffer;
- runtime->executable_code_buffer_size = executable_code_buffer_size;
- runtime->executable_code_chunk_size = EXECUTABLE_CODE_CHUNK_SIZE;
- runtime->executable_code_total_chunks = executable_code_buffer_size / EXECUTABLE_CODE_CHUNK_SIZE;
-}
-
-void
-mono_debugger_server_finalize_mono_runtime (MonoRuntimeInfo *runtime)
-{
- runtime->executable_code_buffer = 0;
-}
-
-static void
-server_ptrace_finalize (ServerHandle *handle)
-{
- x86_arch_finalize (handle->arch);
-
- _server_ptrace_finalize_inferior (handle);
-
- g_free (handle->inferior);
- g_free (handle);
-}
-
-#ifndef __MACH__
-#endif
-
-static ServerCommandError
-server_ptrace_resume (ServerHandle *handle)
-{
- InferiorHandle *inferior = handle->inferior;
- if (inferior->stepping)
- return server_ptrace_step (handle);
- else
- return server_ptrace_continue (handle);
-}
-
-static ServerCommandError
-server_ptrace_detach (ServerHandle *handle)
-{
- InferiorHandle *inferior = handle->inferior;
-
- if (ptrace (PT_DETACH, inferior->pid, NULL, 0)) {
- g_message (G_STRLOC ": %d - %s", inferior->pid, g_strerror (errno));
- return COMMAND_ERROR_UNKNOWN_ERROR;
- }
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_peek_word (ServerHandle *handle, guint64 start, guint64 *retval)
-{
- return server_ptrace_read_memory (handle, start, sizeof (gsize), retval);
-}
-
-static ServerStatusMessageType
-server_ptrace_dispatch_event (ServerHandle *handle, guint32 status, guint64 *arg,
- guint64 *data1, guint64 *data2, guint32 *opt_data_size,
- gpointer *opt_data)
-{
- #ifdef PTRACE_EVENT_CLONE
- if (status >> 16) {
- switch (status >> 16) {
- case PTRACE_EVENT_CLONE: {
- int new_pid;
-
- if (ptrace (PTRACE_GETEVENTMSG, handle->inferior->pid, 0, &new_pid)) {
- g_warning (G_STRLOC ": %d - %s", handle->inferior->pid,
- g_strerror (errno));
- return FALSE;
- }
-
- *arg = new_pid;
- return MESSAGE_CHILD_CREATED_THREAD;
- }
-
- case PTRACE_EVENT_FORK: {
- int new_pid;
-
- if (ptrace (PTRACE_GETEVENTMSG, handle->inferior->pid, 0, &new_pid)) {
- g_warning (G_STRLOC ": %d - %s", handle->inferior->pid,
- g_strerror (errno));
- return FALSE;
- }
-
- *arg = new_pid;
- return MESSAGE_CHILD_FORKED;
- }
-
- case PTRACE_EVENT_EXEC:
- return MESSAGE_CHILD_EXECD;
-
- case PTRACE_EVENT_EXIT: {
- int exitcode;
-
- if (ptrace (PTRACE_GETEVENTMSG, handle->inferior->pid, 0, &exitcode)) {
- g_warning (G_STRLOC ": %d - %s", handle->inferior->pid,
- g_strerror (errno));
- return FALSE;
- }
-
- *arg = 0;
- return MESSAGE_CHILD_CALLED_EXIT;
- }
-
- default:
- g_warning (G_STRLOC ": Received unknown wait result %x on child %d",
- status, handle->inferior->pid);
- return MESSAGE_UNKNOWN_ERROR;
- }
- }
- #endif
-
- if (WIFSTOPPED (status)) {
-#if __MACH__
- handle->inferior->os.wants_to_run = FALSE;
-#endif
- guint64 callback_arg, retval, retval2;
- ChildStoppedAction action;
- int stopsig;
-
- stopsig = WSTOPSIG (status);
- if (stopsig == SIGCONT)
- stopsig = 0;
-
- action = x86_arch_child_stopped (
- handle, stopsig, &callback_arg, &retval, &retval2, opt_data_size, opt_data);
-
- if (action != STOP_ACTION_STOPPED)
- handle->inferior->last_signal = 0;
-
- switch (action) {
- case STOP_ACTION_STOPPED:
- if (stopsig == SIGTRAP) {
- handle->inferior->last_signal = 0;
- *arg = 0;
- } else {
- handle->inferior->last_signal = stopsig;
- *arg = stopsig;
- }
- return MESSAGE_CHILD_STOPPED;
-
- case STOP_ACTION_INTERRUPTED:
- *arg = 0;
- return MESSAGE_CHILD_INTERRUPTED;
-
- case STOP_ACTION_BREAKPOINT_HIT:
- *arg = (int) retval;
- return MESSAGE_CHILD_HIT_BREAKPOINT;
-
- case STOP_ACTION_CALLBACK:
- *arg = callback_arg;
- *data1 = retval;
- *data2 = retval2;
- return MESSAGE_CHILD_CALLBACK;
-
- case STOP_ACTION_CALLBACK_COMPLETED:
- *arg = callback_arg;
- *data1 = retval;
- *data2 = retval2;
- return MESSAGE_CHILD_CALLBACK_COMPLETED;
-
- case STOP_ACTION_NOTIFICATION:
- *arg = callback_arg;
- *data1 = retval;
- *data2 = retval2;
- return MESSAGE_CHILD_NOTIFICATION;
-
- case STOP_ACTION_RTI_DONE:
- *arg = callback_arg;
- *data1 = retval;
- *data2 = retval2;
- return MESSAGE_RUNTIME_INVOKE_DONE;
-
- case STOP_ACTION_INTERNAL_ERROR:
- return MESSAGE_INTERNAL_ERROR;
- }
-
- g_assert_not_reached ();
- } else if (WIFEXITED (status)) {
- *arg = WEXITSTATUS (status);
- return MESSAGE_CHILD_EXITED;
- } else if (WIFSIGNALED (status)) {
- if ((WTERMSIG (status) == SIGTRAP) || (WTERMSIG (status) == SIGKILL)) {
- *arg = 0;
- return MESSAGE_CHILD_EXITED;
- } else {
- *arg = WTERMSIG (status);
- return MESSAGE_CHILD_SIGNALED;
- }
- }
-
- g_warning (G_STRLOC ": Got unknown waitpid() result: %x", status);
- return MESSAGE_UNKNOWN_ERROR;
-}
-
-static ServerStatusMessageType
-server_ptrace_dispatch_simple (guint32 status, guint32 *arg)
-{
- if (status >> 16)
- return MESSAGE_UNKNOWN_ERROR;
-
- if (WIFSTOPPED (status)) {
- int stopsig = WSTOPSIG (status);
-
- if ((stopsig == SIGSTOP) || (stopsig == SIGTRAP))
- stopsig = 0;
-
- *arg = stopsig;
- return MESSAGE_CHILD_STOPPED;
- } else if (WIFEXITED (status)) {
- *arg = WEXITSTATUS (status);
- return MESSAGE_CHILD_EXITED;
- } else if (WIFSIGNALED (status)) {
- if ((WTERMSIG (status) == SIGTRAP) || (WTERMSIG (status) == SIGKILL)) {
- *arg = 0;
- return MESSAGE_CHILD_EXITED;
- } else {
- *arg = WTERMSIG (status);
- return MESSAGE_CHILD_SIGNALED;
- }
- }
-
- return MESSAGE_UNKNOWN_ERROR;
-}
-
-
-static ServerHandle *
-server_ptrace_create_inferior (BreakpointManager *bpm)
-{
- ServerHandle *handle = g_new0 (ServerHandle, 1);
-
- if ((getuid () == 0) || (geteuid () == 0)) {
- g_message ("WARNING: Running mdb as root may be a problem because setuid() and\n"
- "seteuid() do nothing.\n"
- "See http://primates.ximian.com/~martin/blog/entry_150.html for details.");
- }
-
- handle->bpm = bpm;
- handle->inferior = g_new0 (InferiorHandle, 1);
- handle->arch = x86_arch_initialize ();
-
- return handle;
-}
-
-static void
-child_setup_func (InferiorHandle *inferior)
-{
- if (ptrace (PT_TRACE_ME, getpid (), NULL, 0))
- g_error (G_STRLOC ": Can't PT_TRACEME: %s", g_strerror (errno));
-
- if (inferior->redirect_fds) {
- dup2 (inferior->output_fd[1], 1);
- dup2 (inferior->error_fd[1], 2);
- }
-}
-
-static ServerCommandError
-server_ptrace_spawn (ServerHandle *handle, const gchar *working_directory,
- const gchar **argv, const gchar **envp, gboolean redirect_fds,
- gint *child_pid, IOThreadData **io_data, gchar **error)
-{
- InferiorHandle *inferior = handle->inferior;
- int fd[2], ret, len, i;
- ServerCommandError result;
-
- *error = NULL;
- inferior->redirect_fds = redirect_fds;
-
- if (redirect_fds) {
- pipe (inferior->output_fd);
- pipe (inferior->error_fd);
-
- *io_data = g_new0 (IOThreadData, 1);
- (*io_data)->output_fd = inferior->output_fd[0];
- (*io_data)->error_fd = inferior->error_fd[0];
- } else {
- *io_data = NULL;
- }
-
- pipe (fd);
-
- *child_pid = fork ();
- if (*child_pid == 0) {
- gchar *error_message;
- struct rlimit core_limit;
- int open_max;
-
- open_max = sysconf (_SC_OPEN_MAX);
- for (i = 3; i < open_max; i++)
- fcntl (i, F_SETFD, FD_CLOEXEC);
-
- setsid ();
-
- getrlimit (RLIMIT_CORE, &core_limit);
- core_limit.rlim_cur = 0;
- setrlimit (RLIMIT_CORE, &core_limit);
-
- child_setup_func (inferior);
- execve (argv [0], (char **) argv, (char **) envp);
-
- error_message = g_strdup_printf ("Cannot exec `%s': %s", argv [0], g_strerror (errno));
- len = strlen (error_message) + 1;
- write (fd [1], &len, sizeof (len));
- write (fd [1], error_message, len);
- _exit (1);
- } else if (*child_pid < 0) {
- if (redirect_fds) {
- close (inferior->output_fd[0]);
- close (inferior->output_fd[1]);
- close (inferior->error_fd[0]);
- close (inferior->error_fd[1]);
- }
- close (fd [0]);
- close (fd [1]);
-
- *error = g_strdup_printf ("fork() failed: %s", g_strerror (errno));
- return COMMAND_ERROR_CANNOT_START_TARGET;
- }
-
- if (redirect_fds) {
- close (inferior->output_fd[1]);
- close (inferior->error_fd[1]);
- }
- close (fd [1]);
-
- ret = read (fd [0], &len, sizeof (len));
-
- if (ret != 0) {
- g_assert (ret == 4);
-
- *error = g_malloc0 (len);
- read (fd [0], *error, len);
- close (fd [0]);
- if (redirect_fds) {
- close (inferior->output_fd[0]);
- close (inferior->error_fd[0]);
- }
- return COMMAND_ERROR_CANNOT_START_TARGET;
- }
-
- close (fd [0]);
-
- inferior->pid = *child_pid;
-
-#ifndef __MACH__
- if (!_server_ptrace_wait_for_new_thread (handle))
- return COMMAND_ERROR_INTERNAL_ERROR;
-#endif
-
- result = _server_ptrace_setup_inferior (handle);
- if (result != COMMAND_ERROR_NONE) {
- if (redirect_fds) {
- close (inferior->output_fd[0]);
- close (inferior->error_fd[0]);
- }
- return result;
- }
-
-#ifdef __MACH__
- *child_pid = COMPOSED_PID(inferior->pid, inferior->os.thread_index);
-#endif
-
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_initialize_thread (ServerHandle *handle, guint32 pid, gboolean wait)
-{
- InferiorHandle *inferior = handle->inferior;
-
- inferior->is_thread = TRUE;
-
-#ifdef __MACH__
- inferior->pid = GET_PID(pid);
- inferior->os.thread = get_thread_from_index(GET_THREAD_INDEX(pid));
-#else
- inferior->pid = pid;
- if (wait && !_server_ptrace_wait_for_new_thread (handle))
- return COMMAND_ERROR_INTERNAL_ERROR;
-#endif
-
- return _server_ptrace_setup_inferior (handle);
-}
-
-static ServerCommandError
-server_ptrace_attach (ServerHandle *handle, guint32 pid)
-{
- InferiorHandle *inferior = handle->inferior;
-
- if (ptrace (PT_ATTACH, pid, NULL, 0) != 0) {
- g_warning (G_STRLOC ": Can't attach to %d - %s", pid,
- g_strerror (errno));
- return COMMAND_ERROR_CANNOT_START_TARGET;
- }
-
- inferior->pid = pid;
- inferior->is_thread = TRUE;
-
-#ifndef __MACH__
- if (!_server_ptrace_wait_for_new_thread (handle))
- return COMMAND_ERROR_INTERNAL_ERROR;
-#endif
-
- return _server_ptrace_setup_inferior (handle);
-}
-
-static void
-process_output (int fd, gboolean is_stderr, ChildOutputFunc func)
-{
- char buffer [BUFSIZ + 2];
- int count;
-
- count = read (fd, buffer, BUFSIZ);
- if (count < 0)
- return;
-
- buffer [count] = 0;
- func (is_stderr, buffer);
-}
-
-void
-server_ptrace_io_thread_main (IOThreadData *io_data, ChildOutputFunc func)
-{
- struct pollfd fds [2];
- int ret;
-
- fds [0].fd = io_data->output_fd;
- fds [0].events = POLLIN | POLLHUP | POLLERR;
- fds [0].revents = 0;
- fds [1].fd = io_data->error_fd;
- fds [1].events = POLLIN | POLLHUP | POLLERR;
- fds [1].revents = 0;
-
- while (1) {
- ret = poll (fds, 2, -1);
-
- if ((ret < 0) && (errno != EINTR))
- break;
-
- if (fds [0].revents & POLLIN)
- process_output (io_data->output_fd, FALSE, func);
- if (fds [1].revents & POLLIN)
- process_output (io_data->error_fd, TRUE, func);
-
- if ((fds [0].revents & (POLLHUP | POLLERR))
- || (fds [1].revents & (POLLHUP | POLLERR)))
- break;
- }
-
- close (io_data->output_fd);
- close (io_data->error_fd);
- g_free (io_data);
-}
-
-static ServerCommandError
-server_ptrace_set_signal (ServerHandle *handle, guint32 sig, guint32 send_it)
-{
- if (send_it)
- kill (handle->inferior->pid, sig);
- else
- handle->inferior->last_signal = sig;
- return COMMAND_ERROR_NONE;
-}
-
-static ServerCommandError
-server_ptrace_get_pending_signal (ServerHandle *handle, guint32 *signal)
-{
- *signal = handle->inferior->last_signal;
- return COMMAND_ERROR_NONE;
-}
-
-static void
-server_ptrace_set_runtime_info (ServerHandle *handle, MonoRuntimeInfo *mono_runtime)
-{
- handle->mono_runtime = mono_runtime;
-}
-
-static guint32
-server_ptrace_get_current_pid (void)
-{
- return getpid ();
-}
-
-static guint64
-server_ptrace_get_current_thread (void)
-{
- return pthread_self ();
-}
-
-extern void GC_start_blocking (void);
-extern void GC_end_blocking (void);
-
-#ifdef __linux__
-#include "x86-linux-ptrace.c"
-#endif
-
-#ifdef __FreeBSD__
-#include "x86-freebsd-ptrace.c"
-#endif
-
-#ifdef __MACH__
-#include "darwin-ptrace.c"
-#endif
-
-#if defined(__i386__)
-#include "i386-arch.c"
-#elif defined(__x86_64__)
-#include "x86_64-arch.c"
-#else
-#error "Unknown architecture"
-#endif
-
-InferiorVTable i386_ptrace_inferior = {
- server_ptrace_global_init,
- server_ptrace_get_server_type,
- server_ptrace_get_capabilities,
- server_ptrace_create_inferior,
- server_ptrace_initialize_process,
- server_ptrace_initialize_thread,
- server_ptrace_set_runtime_info,
- server_ptrace_io_thread_main,
- server_ptrace_spawn,
- server_ptrace_attach,
- server_ptrace_detach,
- server_ptrace_finalize,
- server_ptrace_global_wait,
- server_ptrace_stop_and_wait,
- server_ptrace_dispatch_event,
- server_ptrace_dispatch_simple,
- server_ptrace_get_target_info,
- server_ptrace_continue,
- server_ptrace_step,
- server_ptrace_resume,
- server_ptrace_get_frame,
- server_ptrace_current_insn_is_bpt,
- server_ptrace_peek_word,
- server_ptrace_read_memory,
- server_ptrace_write_memory,
- server_ptrace_call_method,
- server_ptrace_call_method_1,
- server_ptrace_call_method_2,
- server_ptrace_call_method_3,
- server_ptrace_call_method_invoke,
- server_ptrace_execute_instruction,
- server_ptrace_mark_rti_frame,
- server_ptrace_abort_invoke,
- server_ptrace_insert_breakpoint,
- server_ptrace_insert_hw_breakpoint,
- server_ptrace_remove_breakpoint,
- server_ptrace_enable_breakpoint,
- server_ptrace_disable_breakpoint,
- server_ptrace_get_breakpoints,
- server_ptrace_get_registers,
- server_ptrace_set_registers,
- server_ptrace_stop,
- server_ptrace_set_signal,
- server_ptrace_get_pending_signal,
- server_ptrace_kill,
- server_ptrace_get_signal_info,
- server_ptrace_get_threads,
- server_ptrace_get_application,
- server_ptrace_detach_after_fork,
- server_ptrace_push_registers,
- server_ptrace_pop_registers,
- server_ptrace_get_callback_frame,
- server_ptrace_restart_notification,
- server_ptrace_get_registers_from_core_file,
- server_ptrace_get_current_pid,
- server_ptrace_get_current_thread
-};
diff --git a/sysdeps/server/x86-ptrace.h b/sysdeps/server/x86-ptrace.h
deleted file mode 100644
index ae074d4..0000000
--- a/sysdeps/server/x86-ptrace.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef __MONO_DEBUGGER_X86_64_PTRACE_H__
-#define __MONO_DEBUGGER_X86_64_PTRACE_H__
-
-typedef struct OSData OSData;
-
-struct InferiorHandle
-{
- OSData os;
-
- guint32 pid;
- int stepping;
- int last_signal;
- int redirect_fds;
- int output_fd [2], error_fd [2];
- int is_thread;
-};
-
-#ifndef PTRACE_SETOPTIONS
-#define PTRACE_SETOPTIONS 0x4200
-#endif
-#ifndef PTRACE_GETEVENTMSG
-#define PTRACE_GETEVENTMSG 0x4201
-#endif
-
-#ifndef PTRACE_EVENT_FORK
-
-/* options set using PTRACE_SETOPTIONS */
-#define PTRACE_O_TRACESYSGOOD 0x00000001
-#define PTRACE_O_TRACEFORK 0x00000002
-#define PTRACE_O_TRACEVFORK 0x00000004
-#define PTRACE_O_TRACECLONE 0x00000008
-#define PTRACE_O_TRACEEXEC 0x00000010
-#define PTRACE_O_TRACEVFORKDONE 0x00000020
-#define PTRACE_O_TRACEEXIT 0x00000040
-
-/* Wait extended result codes for the above trace options. */
-#define PTRACE_EVENT_FORK 1
-#define PTRACE_EVENT_VFORK 2
-#define PTRACE_EVENT_CLONE 3
-#define PTRACE_EVENT_EXEC 4
-#define PTRACE_EVENT_VFORKDONE 5
-#define PTRACE_EVENT_EXIT 6
-
-#endif /* PTRACE_EVENT_FORK */
-
-static ServerCommandError
-_server_ptrace_check_errno (InferiorHandle *);
-
-static ServerCommandError
-_server_ptrace_make_memory_executable (ServerHandle *handle, guint64 start, guint32 size);
-
-static ServerCommandError
-_server_ptrace_get_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs);
-
-static ServerCommandError
-_server_ptrace_set_registers (InferiorHandle *inferior, INFERIOR_REGS_TYPE *regs);
-
-static ServerCommandError
-_server_ptrace_get_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs);
-
-static ServerCommandError
-_server_ptrace_set_fp_registers (InferiorHandle *inferior, INFERIOR_FPREGS_TYPE *regs);
-
-static ServerCommandError
-_server_ptrace_read_memory (ServerHandle *handle, guint64 start,
- guint32 size, gpointer buffer);
-
-static ServerCommandError
-server_ptrace_read_memory (ServerHandle *handle, guint64 start, guint32 size, gpointer buffer);
-
-static ServerCommandError
-server_ptrace_write_memory (ServerHandle *handle, guint64 start,
- guint32 size, gconstpointer buffer);
-
-static ServerCommandError
-server_ptrace_poke_word (ServerHandle *handle, guint64 addr, gsize value);
-
-static ServerCommandError
-_server_ptrace_set_dr (InferiorHandle *handle, int regnum, guint64 value);
-
-static ServerCommandError
-_server_ptrace_get_dr (InferiorHandle *handle, int regnum, guint64 *value);
-
-static ServerCommandError
-server_ptrace_continue (ServerHandle *handle);
-
-static ServerCommandError
-server_ptrace_step (ServerHandle *handle);
-
-static ServerCommandError
-server_ptrace_kill (ServerHandle *handle);
-
-static ServerCommandError
-server_ptrace_stop (ServerHandle *handle);
-
-static ServerCommandError
-server_ptrace_stop_and_wait (ServerHandle *handle, guint32 *status);
-
-static ServerCommandError
-_server_ptrace_setup_inferior (ServerHandle *handle);
-
-static void
-_server_ptrace_finalize_inferior (ServerHandle *handle);
-
-static ServerCommandError
-server_ptrace_get_signal_info (ServerHandle *handle, SignalInfo **sinfo);
-
-static gboolean
-_server_ptrace_wait_for_new_thread (ServerHandle *handle);
-
-#endif
diff --git a/test/Makefile.in b/test/Makefile.in
index f81d542..66dc310 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -129,6 +129,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/test/framework/Makefile.in b/test/framework/Makefile.in
index 18fcfb3..c65b213 100644
--- a/test/framework/Makefile.in
+++ b/test/framework/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index c140baf..0156f14 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/test/src/Makefile.in b/test/src/Makefile.in
index 36e7704..1e7e91e 100644
--- a/test/src/Makefile.in
+++ b/test/src/Makefile.in
@@ -156,6 +156,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
diff --git a/test/testsuite/Makefile.in b/test/testsuite/Makefile.in
index 0e629ac..9e51cba 100644
--- a/test/testsuite/Makefile.in
+++ b/test/testsuite/Makefile.in
@@ -117,6 +117,7 @@ PATH = @PATH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+READLINE_DEPLIBS = @READLINE_DEPLIBS@
SED = @SED@
SERVER_DEPENDENCIES_CFLAGS = @SERVER_DEPENDENCIES_CFLAGS@
SERVER_DEPENDENCIES_LIBS = @SERVER_DEPENDENCIES_LIBS@
--
mono-debugger
More information about the Pkg-mono-svn-commits
mailing list