Comments on: Hexy Little Thing https://red-sweater.com/blog/279/hexy-little-thing Official blog of Red Sweater Software Sat, 03 Mar 2007 20:43:43 +0000 hourly 1 https://wordpress.org/?v=5.2.3 By: Bjoern Kriews https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-63537 Sat, 03 Mar 2007 20:43:43 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-63537 Hi Daniel, thanks – this is really useful.
I made a minor modification to display the concrete classname
and its address so one can distinguish different objects.

— NSData+RSHexDump.m 2007-02-14 19:47:59.000000000 +0100
+++ NSData+RSHexDump.m.bkr 2007-03-03 21:40:05.000000000 +0100
@@ -53,7 +53,8 @@
}

// Start the hexdump out with an overview of the content
– NSMutableString *buf = [NSMutableString stringWithFormat:@”NSData %d bytes%@:\n”, [self length], curtailInfo];
+ NSMutableString *buf = [NSMutableString stringWithFormat:@”%@(%p) %d bytes%@:\n”,
+ NSStringFromClass([self class]), self, [self length], curtailInfo];

// One row of 16-bytes at a time …
int i, j;

]]>
By: Wevah https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56654 Thu, 15 Feb 2007 21:53:39 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56654 Nice! (Though I’d probably rather use an NSRange for the second.)

]]>
By: Blake C. https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56391 Thu, 15 Feb 2007 04:19:28 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56391 alexr- I don’t have a mactel, but isn’t the MB plugin PPC-only?

]]>
By: Karsten https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56372 Thu, 15 Feb 2007 03:18:07 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56372 Thanks a lot for this great tip!
I just blogged about something similar. It’s about a project i started some weeks ago about improving the debugging experience in Xcode. You can read it at http://briksoftware.com/blog/wp-trackback.php?p=24

Karsten

]]>
By: Daniel Jalkut https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56330 Wed, 14 Feb 2007 22:32:47 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56330 alexr: Extending that logic would lead one to question the use of – description methods in any classes. I am happy to trade the (quite minimal) code bloat for an improved debugging experience that fits in with the existing object-inspection pattern.

Even with the “dm” command, I’d have to conceptually thing “display memory” and coerce the NSData into an address, instead of using the same “po” habit that I use everywhere.

]]>
By: alexr https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56329 Wed, 14 Feb 2007 22:25:03 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56329 Why bloat your code like this? You should demand more from your debugger.

The MacsBug plugin for gdb has the “dm” command, which can be trivially added via gdb’s scripting language if you don’t want the entire plugin.

]]>
By: James Gregurich https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56326 Wed, 14 Feb 2007 22:10:07 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56326 I did something similar in my work. I wrote a little function that dumps data from a file stream object into a simple buffer and then prints the buffer value to stdout.

I can call this function from the gdb command line then copy and paste the pointer value to the xcode memory browser to view the data.

The ultimate solution to the problem is for apple to beef up the memory browser in xcode and make it more useful and convenient to use. Why shouldn’t you be able to right click on an NSData instance and choose a menu item that brings up a memory browser for it. You should even be able to edit in the memory browser rather than haveing to drop to the gdb command line to manually change items in the buffer.

]]>
By: Mark Grimes https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56297 Wed, 14 Feb 2007 20:10:27 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56297 Thanks for the pointer Daniel, this helps out a lot!

]]>
By: scott lewis https://red-sweater.com/blog/279/hexy-little-thing/comment-page-1#comment-56283 Wed, 14 Feb 2007 19:27:08 +0000 http://www.red-sweater.com/blog/279/hexy-little-thing#comment-56283 I think this post provides the answer to the question you posed in the previous one: yes, C is the new assembly. :)

]]>