Skip to content

Commit

Permalink
[feat] Added more methods for ASP.NET
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Alekseev <arthur100500@gmail.com>
  • Loading branch information
arthur100500 authored and MchKosticyn committed Nov 23, 2023
1 parent dee256b commit dccac48
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion VSharp.IL/Loader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,11 @@ module Loader =
"System.String System.Environment.get_SystemDirectory()"
"System.Void System.Diagnostics.StackTrace..ctor(this)"
"System.String System.BadImageFormatException.get_Message(this)"
"System.String System.Environment.GetFolderPath(System.Environment+SpecialFolder)"
"System.String System.AppContext.GetBaseDirectoryCore()"
"System.String System.IO.Path.GetFullPath(System.String)"
"System.Boolean System.OperatingSystem.IsOSPlatform(System.String)"
"System.Collections.IDictionary System.Environment.GetEnvironmentVariables()"
"System.String System.Environment.GetFolderPath(System.Environment+SpecialFolder)"

// Text
"System.Int32 System.Text.UTF8Encoding.GetBytes(this, System.String, System.Int32, System.Int32, System.Byte[], System.Int32)"
Expand Down
11 changes: 11 additions & 0 deletions VSharp.InternalCalls/Reflection.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace VSharp.System

open System.Reflection
open global.System
open VSharp.Core

module internal Reflection =
let getEntryAssembly (state : state) (_ : term list) =
let m = Memory.EntryFunction state
let asm = m.DeclaringType.Assembly
Memory.ObjectToTerm state asm typeof<Assembly>
9 changes: 9 additions & 0 deletions VSharp.InternalCalls/Reflection.fsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace VSharp.System

open global.System
open VSharp
open VSharp.Core

module internal Reflection =
[<Implements("System.Reflection.Assembly System.Reflection.Assembly.GetEntryAssembly()")>]
val getEntryAssembly : state -> term list -> term
2 changes: 2 additions & 0 deletions VSharp.InternalCalls/VSharp.InternalCalls.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
<Compile Include="Activator.fs" />
<Compile Include="Object.fsi" />
<Compile Include="Object.fs" />
<Compile Include="Reflection.fsi" />
<Compile Include="Reflection.fs" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions VSharp.SILI.Core/API.fs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ module API =
let CallStackContainsFunction state method = CallStack.containsFunc state.stack method
let CallStackSize state = CallStack.size state.stack
let GetCurrentExploringFunction state = CallStack.getCurrentFunc state.stack
let EntryFunction state = CallStack.entryFunction state.stack

let BoxValueType state term = Memory.allocateBoxedLocation state term

Expand Down
1 change: 1 addition & 0 deletions VSharp.SILI.Core/API.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ module API =
val CallStackContainsFunction : state -> IMethod -> bool
val CallStackSize : state -> int
val GetCurrentExploringFunction : state -> IMethod
val EntryFunction : state -> IMethod

val BoxValueType : state -> term -> term

Expand Down
3 changes: 3 additions & 0 deletions VSharp.SILI.Core/CallStack.fs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ module internal CallStack =
let stackTrace (stack : callStack) =
stack.frames |> List.choose (fun frame -> frame.func)

let entryFunction (stack : callStack) =
stackTrace stack |> List.last

let stackTraceString (stack : callStack) =
stack.frames
|> Stack.map (fun f ->
Expand Down

0 comments on commit dccac48

Please sign in to comment.