views:

21

answers:

1

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?

+2  A: 

Odd code, 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.

Hans Passant
Thanks, I don't know why I didn't think of something so simple. I know the segment registers are used for DLL-related stuff, so I thought it might be pointing off into the data segment of a DLL or something.
Adam Rosenfield