Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Started on Greybeard, which is the library for reading module metadata

  • Loading branch information...
commit 37bd266c25969f18c294179e2d9a051c06231d7a 1 parent bc7cece
Steve Officer authored
View
3  Dovahkiin/Communication.cpp
@@ -43,7 +43,6 @@ Communication::~Communication() {
}
void Communication::NotifyClassLoad(ClassID class_id, mdTypeDef type_definition_token, wstring assembly_name) {
- cout << "Doing class load stuff\n";
wstringstream message;
message << L"CLASSLOAD" << DELIM << class_id << DELIM << type_definition_token << DELIM << assembly_name << "\r\n";
wstring to_send = message.str();
@@ -51,7 +50,6 @@ void Communication::NotifyClassLoad(ClassID class_id, mdTypeDef type_definition_
}
void Communication::NotifyClassUnload(ClassID class_id) {
- cout << "Doing class unload stuff\n";
wstringstream message;
message << L"CLASSUNLOAD" << DELIM << class_id << "\r\n";
wstring to_send = message.str();
@@ -66,7 +64,6 @@ void Communication::NotifyObjectAllocated(ObjectID object_id, ClassID object_typ
}
void Communication::NotifyObjectIDsChanged(ObjectID old_ids[], ObjectID new_ids[]) {
- cout << "Doing object id stuff\n";
/*
wstringstream message;
message L"CLASSLOAD" << class_id << L"|" << assembly_name << "\n";
View
1  Dovahkiin/ProfilerCallback.cpp
@@ -80,6 +80,7 @@ HRESULT ProfilerCallback::Initialize(IUnknown *pICorProfilerInfoUnk) {
);
// Later I also want to track function calls so that I can forward this information on.
+ // This allows us to track things like dispose, add input, remove input and update cycles.
m_token_cache = new TokenCache(m_profiler_info);
return S_OK;
View
11 GreyBeard/GreyBeard.cpp
@@ -1,6 +1,15 @@
// This is the main DLL file.
#include "stdafx.h"
-
#include "GreyBeard.h"
+GreyBeard::Inspector::Inspector() {
+ CoInitialize(NULL);
+ CoCreateInstance(
+ CLSID_CorMetaDataDispenser,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_IMetaDataImport,
+ (LPVOID*)&m_metadata_inspector
+ );
+}
View
13 GreyBeard/GreyBeard.h
@@ -1,13 +1,14 @@
-// GreyBeard.h
-
#pragma once
+#include "windows.h"
+#include "cor.h"
using namespace System;
namespace GreyBeard {
-
- public ref class Class1
- {
- // TODO: Add your methods for this class here.
+ public ref class Inspector {
+ private:
+ IMetaDataImport* m_metadata_inspector;
+ public:
+ Inspector();
};
}
View
2  GreyBeard/Stdafx.h
@@ -3,5 +3,3 @@
// but are changed infrequently
#pragma once
-
-
View
4 Thuum/PipeReader.fs
@@ -31,7 +31,9 @@ let ListenToPipe (msg_handler : Message MailboxProcessor) =
let rec get_messages() : unit =
let raw_message = stream_reader.ReadLine()
if raw_message = null
- then () // Exit the function, the pipe is closed
+ then
+ printfn "No More Messages"
+ ()
else
match ReadMessage raw_message with
| Some message -> msg_handler.Post(message)
View
22 Thuum/Program.fs
@@ -1,23 +1,27 @@
// Learn more about F# at http://fsharp.net
printfn "FUS RO DAH"
+type ClassInfo = {
+ Name : string
+}
+
// Mailbox processor for handling incomming messages.
let message_handler = MailboxProcessor.Start(fun messagebox ->
- let rec loop() = async {
+ let rec loop (class_info : Map<PipeReader.ClassID, ClassInfo>) = async {
let! msg = messagebox.Receive()
match msg with
| PipeReader.ClassLoad (class_id, type_def_token, module_name) ->
- printfn "ClassLoad %d - %d - %s" class_id type_def_token module_name
- return! loop()
+ return! loop (class_info.Add(class_id, {Name = "MadeUp Class Name"}))
| PipeReader.ClassUnload (class_id) ->
- printfn "ClassUnload %d" class_id
- return! loop()
+ return! loop (class_info.Remove(class_id))
| PipeReader.ObjectAllocated (object_id, class_id) ->
- printfn "Object Alloc %d - %d" object_id class_id
- return! loop()
+ match class_info.TryFind(class_id) with
+ | Some info -> ()
+ | None -> () // Need to add it to the deferred object allocation queue, the class will be loaded later.
+ return! loop class_info
}
- loop()
+ loop Map.empty
)
// The thread that the namedpipe client listens on
@@ -32,6 +36,4 @@ let listen_for_messages() =
// this is on the main thread
let message_thread = listen_for_messages()
-printfn "Job done"
-printfn "Thread %d" System.Threading.Thread.CurrentThread.ManagedThreadId
System.Console.ReadLine() |> ignore
Please sign in to comment.
Something went wrong with that request. Please try again.