How can I create specialized metadata nodes via llvm-c API? - llvm

I'd like to add debugging information to a LLVM-generated code. I'm using LLVM C API (since I'm calling LLVM from Smalltalk via FFI).
Debug informations are attached via specialized metadata nodes, but I could not find any way to create them. By looking to LLVM source code, it seems that I'd need to create metadata node with certain kind (say DILocationKind) but the "kind" enum seems not exposed by LLVM-C API nor LLVMMDNode() allows for passing the "kind" as an argument.
Is there a way create specialized metadata nodes using LLVM-C API?
Could somebody point me to some example how to add debug information to LLVM-generated code using LLVM-C API?

Related

Microsoft bond c++ runtime deserialization using runtime schema

I could not find anything useful in their docs or examples :(
They have docs of how to deserialize schema, and then how to traverse it - that works great.
They have also two examples:
how to use bond::bonded<void> with runtime schema to convert binary to json
how to use bond::bonded<void> with runtime schema and MapTo to parse data into some custom ViewStruct
What I need is: to traverse the bond:bonded<void> to extract fields from it.
In protobuf you have field descriptors (created using FinFieldByName) and then you use them in runtime methods msg->getString, msg->getInt32 to get the typed value.
There's nothing built in that allows you to traverse a bonded<void> and inspect its fields. If you need to do that generically, you'll need to implement a custom transform and then use bond::Apply() to apply the transform to a bonded<void> constructed from a reader and a runtime schema. See in particular the transform and access_control examples for how to start writing a transform.
Bond needs this level of indirection compared to Protocol Buffers because Bond supports pluggable encoding protocols. If you know that you will only have to process a specific protocol, you could use that protocol's reader type with the runtime schema to walk the fields in the payload. See Microsoft Bond deserialization without knowing underlying schema for a C# example of the core of this algorithm.

How to fetch Edge browsing history programmatically? Is there is any way using COM/Windows API to fetch it? [duplicate]

I used FindFirstUrlCacheEntry/FindNextUrlCacheEntry Win API to get Internet Explorer's history programmatically in C++.
Can you tell me how to get Microsoft Edge History using C++ (Windows API)?
Not possible at this point in time. Might want to use the 'suggestions routes' at some of the links below.
Developer Feedback Home - https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer
Developer Feedback Twitter - https://www.twitter.com/msedgedev
Feature Suggestions - https://windowsphone.uservoice.com/forums/101801-feature-suggestions/category/18985-web-browsing
Healy in Tampa
The history is stored in \AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat. It uses Microsoft’s Extensible Storage Engine to store data. There is a C++ wrapper for accessing Extensible Storage Engine files I've used to access data from this file.
The "Containers" table inside WebCacheV01.dat tells which "Container_X" tables have type of "Content" or "History", as well as the Secure Directories and their order. You can use the ESEDatabaseView utility to view the data inside the WebCacheV01.dat file.

Enumerating Microsoft Edge History Programmatically

I used FindFirstUrlCacheEntry/FindNextUrlCacheEntry Win API to get Internet Explorer's history programmatically in C++.
Can you tell me how to get Microsoft Edge History using C++ (Windows API)?
Not possible at this point in time. Might want to use the 'suggestions routes' at some of the links below.
Developer Feedback Home - https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer
Developer Feedback Twitter - https://www.twitter.com/msedgedev
Feature Suggestions - https://windowsphone.uservoice.com/forums/101801-feature-suggestions/category/18985-web-browsing
Healy in Tampa
The history is stored in \AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat. It uses Microsoft’s Extensible Storage Engine to store data. There is a C++ wrapper for accessing Extensible Storage Engine files I've used to access data from this file.
The "Containers" table inside WebCacheV01.dat tells which "Container_X" tables have type of "Content" or "History", as well as the Secure Directories and their order. You can use the ESEDatabaseView utility to view the data inside the WebCacheV01.dat file.

Are there tools for generating the clients model from an odata metadata?

Back in the good old days of flex (anyone?) flash builder provided a tool for generating the clients model based on the server model. Is there something similar for generating, say an ember's app model, based on the odata metadata?
datajs documentation does mention the subject. Though the reference for OData.read used in the sample doesn't say explicitly that it interprets the metadata somehow, it seems implied. You'll have to verify that.
It does take an optional metadata object however, suggesting there exists a formal representation for metadata to the library -- I would imagine generated via OData.read. Documentation seems non-existent. I don't know what that looks like.
From there, you should be able to further transform the model to something suitable for Ember.
(datajs is a low-level javascript library that implements client-side OData operations.)
I also know that JayStack provides a JaySvcUtil, a CLI process assembly (.NET program) that extracts metadata. The destination format is JavaScript code, though the model it uses is specific to JayData. Still, you may be able to work from there.
As mentioned by Maya, Microsoft provides the OData Client Code Generator, which generates .NET proxies. Might be more difficult to transform that.
If none of these work for you (which is actually likely), you can always parse the $metadata resource yourself -- I believe it always uses an XML representation in all current versions of OData.
If you need to do it dynamically in the browser, use DOMParser or XMLHttpRequest. More information.
If you can do it statically, then by all means do so -- it's simply best for performance. In this case, you can use whatever language and runtime tools you want to fetch, parse, transform and re-serialize the model.
The format (CSDL) is specified for OData here (v4) and here (v3).
Finally, check out this list, something new may appear that better fits your needs.
There are two suggestion which may help you.
1, OData provide client code generator to generate client-side proxy class. Just need to pass metadata url, .net client code will be generate for you. You can follow the following blog:
http://blogs.msdn.com/b/odatateam/archive/2014/03/11/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx
2, If the model means "EdmModel", you can just de-serialize $metadata. OData reader can de-serialize the $metadata to IEdmModel, which can be used in client side. The following is sample code:
HttpWebRequestMessage message = new HttpWebRequestMessage(new Uri(ServiceBaseUri.AbsoluteUri + "$metadata", UriKind.Absolute));
message.SetHeader("Accept", MimeTypes.ApplicationXml);
using (var messageReader = new ODataMessageReader(message.GetResponse()))
{
Model = messageReader.ReadMetadataDocument();
}

How do I iterate through IO Kit's keys?

I am trying to get a list of all devices in the system together with how they are connected. Therefore, I want to essentially clone the structure of the IO Kit services tree (that you can see with IORegistryExplorer). How do I iterate through all the keys? (One of the reasons this is confusing to me is because I dont understand what the difference between io_service, io_registry, and io_object are).
The difference between service, registry and object is only in the circumstances they are used. Otherwise they are completely the same.
From IOTypes.h:
typedef io_object_t io_registry_entry_t;
typedef io_object_t io_service_t;
There is documentation available about Traversing the I/O Registry, which also includes information on traversing the whole registry.
For each entry you then would have to get the properties and save them with your representation of the registry.
So you would use IORegistryGetRootEntry(), print/save its name and properties and then iterate over the children with IORegistryEntryGetChildIterator().
You get the properties with IORegistryEntryCreateCFProperties() following aCFDictionaryGetKeysAndValues(). For the values you then have to check what types these are to print/save them (or use CFSHOW). When you really want to clone this into a different structure (with different types) you have to handle every possible CFTypeID explicitely.
I created a working prototype at
https://gist.github.com/JonnyJD/6126680
EDIT:
In another SO answer the (C) source code of ioreg is linked. That should be a good resource for printing/extracting missing CFTypes.