Add a DebuggerSafe option to the ini to help with debugging in visual studio. This essentially silences exceptions in the script engine. Disabled by default, naturally.

avinationmerge
meta7 2010-08-09 23:35:40 -07:00
parent f0bad66d41
commit eb5c508f8b
2 changed files with 16 additions and 3 deletions

View File

@ -100,6 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected int m_notecardLineReadCharsMax = 255;
protected int m_scriptConsoleChannel = 0;
protected bool m_scriptConsoleChannelEnabled = false;
protected bool m_debuggerSafe = false;
protected IUrlModule m_UrlModule = null;
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
new Dictionary<UUID, UserInfoCacheEntry>();
@ -110,6 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host = host;
m_localID = localID;
m_itemID = itemID;
m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
m_ScriptDelayFactor =
m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
@ -3220,13 +3222,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return m_host.OwnerID.ToString();
}
[DebuggerNonUserCode]
public void llInstantMessage(string user, string message)
{
UUID result;
if (!UUID.TryParse(user, out result))
{
throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user));
if (!m_debuggerSafe)
{
throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user));
}
return;
}

View File

@ -129,6 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
internal float m_ScriptDelayFactor = 1.0f;
internal float m_ScriptDistanceFactor = 1.0f;
internal bool m_debuggerSafe = false;
internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
@ -137,6 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host = host;
m_localID = localID;
m_itemID = itemID;
m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
m_OSFunctionsEnabled = true;
@ -195,7 +197,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal void OSSLError(string msg)
{
throw new Exception("OSSL Runtime Error: " + msg);
if (m_debuggerSafe)
{
OSSLShoutError(msg);
}
else
{
throw new Exception("OSSL Runtime Error: " + msg);
}
}
private void InitLSL()