Adam Rosenfield
Adam Rosenfield

Reputation: 400462

How do you view segment-offset memory addresses in the Visual Studio debugger?

I'm debugging some code from the disassembly (no source code is available), and there a number of instructions accessing data via the ds segment register, e.g. something like this:

66 3B 05 8A B1 43 00 cmp         ax,word ptr ds:[43B18Ah]

How do you get the Visual Studio debugger to tell you the offset of the ds segment register so that I can inspect the memory this is referring to? The Watch window does not seem to accept expressions like ds:[0x43B18A] or variants; it will tell me that ds is 0, but that doesn't tell me what segment 0's offset is.

Is there some special syntax for this, or is this something that VS just can't do? Would I have better luck with another debugger, such as WinDbg or ntsd?

Upvotes: 3

Views: 4201

Answers (1)

Hans Passant
Hans Passant

Reputation: 942020

This is a quirk of the disassembler built into Visual Studio. It is superfluous, the DS register is the default. Just ignore it, on Windows the DS, CS and ES registers are set to the same value. A protected mode selector. And the same value used by the Memory window. Just omit the ds: prefix.

Upvotes: 5

Related Questions