What's the ip2md equivalent in ClrMD - windbg

I know how to iterate the object in the memory, but I'm about to do something with ClrMD as the !ip2md command in WinDBG/SOS. What exactly should I do?

The source code to SOS is now open source. You can see exactly what !ip2md does:
https://github.com/dotnet/coreclr/tree/master/src/ToolBox/SOS

Related

How do I get a `Pipe` to the standard input/output/error in Swift?

When using Process in Swift, if you do not specify the .standardInput, .standardOutput, or .standardError properties, the Process inherits the standard input/output/error of the caller, which can be quite useful. But let's say that, for example, I want to tell a Process to send its output to the inherited standard error. It seems to me I would want to do something like process.standardOutput = ProcessInfo.processInfo.standardError, but ProcessInfo has no standardError property. How am I supposed to do something like this?
Of course I find the answer to this immediately after posting this question.
The desired objects are FileHandle.standardInput, FileHandle.standardOutput, and FileHandle.standardError.

How do you get a runtime path for the current file in Racket?

Suppose I have a file called "test.rkt" for which I want to have its absolute path available at runtime. I know that the best way to do this is to bind it using:
(define-runtime-path orig-file "test.rkt")
However, for reflection purposes, I would like to be able to do this without knowing the name of the current file. For example, I would like to be able to do something like:
(define-runtime-path-self orig-file)
You can use #%variable-reference, which (IIRC) is the low-level reflective magic behind define-runtime-path:
(resolved-module-path-name
(variable-reference->resolved-module-path
(#%variable-reference)))
There's also the syntax/location library:
(require syntax/location)
(quote-source-file)
but beware that if you compile the file in one location and then move source file and compiled/ directory to another location, the program will print the location where it was compiled, not where it was run.
There's also a way that goes through syntax objects and module-path-indexes, but that's more complicated.
Does (find-system-path 'run-file) or (simple-form-path (find-system-path 'run-file)) work for you?

Where can I find surfnorm.m in MATLAB 2014a or 2014b?

I've recently been using the surfnorm function and would like to access the code to see what it's actually doing. I assume it's stored on my PC somewhere, but I don't know where.
Type in edit surfnorm to open it or which surfnorm to display the path.

Why can't my Perl object find its skip() method, even though I can call it as a subroutine?

I'm working on a Perl module and whenever I call the skip() method I wrote in the following way:
$cursor->skip(4);
I get:
Undefined subroutine &MyModule::Cursor::skip called at t/tester.pl line 24.
(in cleanup) invalid object at t/tester.pl line 24.
When I call it like:
MyModule::Cursor::skip($cursor, 4);
Perl finds it!
Oddly, if I name "skip" anything else ("skipper", "hello"), this syntax works:
$cursor->skipper(4);
I thought maybe skip() was a "secret" reserved key word or something, but I've also got methods named sort() and next() (which I know are reserved), and those work fine.
I'd really like to name this method "skip." Does anyone know why Perl can't find it?
skip() is exported from Test::More, which you might have loaded since your executable is named t/tester.pl.
What does ref($cursor) yield you? It should be a blessed MyModule::Cursor object, but the "invalid object" error might be suggesting the object was not constructed properly.
EDIT: perldiag gives another clue: "in cleanup" signifies that a problem was encountered by the object's destructor. Assuming you don't already have a destructor in the object, create a MyModule::Cursor::DESTROY method that Data::Dumps the object to see what it looks like at this time.
A concise snippet of example code that exhibits this behaviour would be very helpful.
Without actual code, it's difficult to debug this.
Do you use MyModule::Cursor in your test code? When you replaced skip with skipper, were you calling it in exactly the same way from your test module? Are you able to use skip from a throw-away (one-liner or very short script)?
Where I'm going with this is looking for an error in your test code, rather than the module.
UPDATE: You're not doing something like declaring methods on MyModule::Cursor in two different files, are you? The error message you're getting tells me it has a blessed reference to an object of type MyModule::Cursor, so it knows about the class; but then it can't find the definition of skip. Do you happen to declare part of MyModule::Cursor in one file, and skip in another, and your test module isn't including the second file? Or do you have a syntax error somewhere around your definition of skip -- a missing semi-colon or unpaired curly brace? (But then again, why would MyModule::Cursor::skip work where $cursor->skip does not?)

Windbg: SOS.dll: !gcroot: DOMAIN(xxx):HANDLE(Pinned):Does it really mean object is pinned?

The documentation on the SOS.dll Windbg extension seems sparse. After issuing a !gcroot <address>, I am getting something containing the following:
DOMAIN(XXX):HANDLE(Pinned):XXX:Root:XXX(System.Object[])->
Does "HANDLE(Pinned)" really mean there is a GCHandle of type GCHandleType.Pinned that is rooting this object?
It's probably not pinned, per se, but rather is probably a static reference. Take a look here: http://blogs.msdn.com/dougste/archive/2005/11/25/497016.aspx
Yes it does mean the object is pinned. Now you have to find what is pinning the object and preventing it from being garbage collected.
Yes it does. Another possible value instead of pinned is WeakLn, which means it will be garbage collected on the next sweep.
I know that Karel Zikmund, MSFT Moderator at http://social.msdn.microsoft.com/Forums/en-US/clr/thread/e52936b4-15c4-434f-91b9-4640df66d0c6 says "yes." But I'm looking for extra opinions, insight, etc. Thanks!