After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 465137 - Add ability to specify a starting offset
Add ability to specify a starting offset
Status: RESOLVED FIXED
Product: ghex
Classification: Applications
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Jaka Mocnik
Jaka Mocnik
Depends on:
Blocks: 395701
 
 
Reported: 2007-08-09 18:42 UTC by Jonathon Jongsma
Modified: 2007-12-21 14:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] Add ability to specify arbitrary starting address for offsets in GtkHex widget (2.72 KB, patch)
2007-12-01 04:56 UTC, Jonathon Jongsma
committed Details | Review

Description Jonathon Jongsma 2007-08-09 18:42:29 UTC
I'm in need of a basic hex-editor widget for use in the nemiver debugger.  the GtkHex widget looks like a good candidate, but it currently is constructed with a HexDocument* argument, which assumes that the data is being read from a file.

For my use, I would be sending the 'read memory' command to gdb with a particular address and a number of bytes to read.  This will essentially give me back the starting address I passed in and an array of data bytes.  I'd like to be able to pass this data to the hex editor widget to be displayed and edited.

But in my situation, there's no concept of a 'document' involved, so I'm not sure whether it makes sense to modify the HexDocument class to allow it to behave in a non-document mode, or if it would be better to separate the document functionality completely out.  Perhaps create a base class like HexDataModel, which just deals with data buffers and then have HexDocument inherit from this new base class and extend it with some file loading/saving file-specific functionality.

The other thing I would need that doesn't seem to be supported yet by this widget is to be able to set an arbitrary start address instead of always starting from 0.

I'm willing to do the work required, but would appreciate some feedback on the best approach to take.
Comment 1 Rodney Dawes 2007-08-09 18:57:39 UTC
Abstracting the data model seems like the best approach. It will probably be needed to be able to implement loading from VFS sources properly as well, as we will just be getting data through the VFS stream. And being able to specify the starting address value sounds sane to me. Having the class abstracted would probably make it easier to deal with loading large files as well.

Thanks for volunteering to do the work.
Comment 2 Jonathon Jongsma 2007-09-08 03:12:10 UTC
I'm coming to the realization that I'm really not going to ever get the motivation to actually do this in gobject, so if anybody else feels the motivation, feel free to step up.
Comment 3 Jonathon Jongsma 2007-11-29 02:41:41 UTC
OK, so I'm an idiot.  This is already possible using hex_document_set_data().  So I think the only thing I really need is a way to specify an arbitrary starting address/offset.  Updating bug summary
Comment 4 Jonathon Jongsma 2007-12-01 04:56:04 UTC
Created attachment 99951 [details] [review]
[PATCH] Add ability to specify arbitrary starting address for offsets in GtkHex widget


	* src/gtkhex.c:
	* src/gtkhex.h: add API to set a starting offset address.  In some ways it
	seems that this information is a property of the document rather than the
	view, but the GtkHex widget does all of the offset-related stuff, so I put
	it here.  This is useful for using this widget as a debugger memory editor
	since we'll only read a small amount of memory from gdb and we want to be
	able to label the rows with the correct address.  Fix for bug #465137
---
 ChangeLog    |   10 ++++++++++
 src/gtkhex.c |   10 +++++++++-
 src/gtkhex.h |    2 ++
 3 files changed, 21 insertions(+), 1 deletions(-)
Comment 5 Jonathon Jongsma 2007-12-19 14:55:36 UTC
just fyi, I'm waiting for these changes to get into ghex svn so I can start committing the experimental memory editing stuff for nemiver.
Comment 6 Rodney Dawes 2007-12-21 14:19:00 UTC
Looks good. Please commit. Thanks!
Comment 7 Jonathon Jongsma 2007-12-21 14:51:03 UTC
Thanks, committed as r1178