<div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks for the reply Maurizio,<div><br></div><div>> Which of the two pieces of functionalities you find yourselves more in need of? Memory inspection (e.g. segment + layout -> string), or hexdump? Or both?</div><div><div><br></div><div>I found it useful to be able to both hex-dump Buffer/ByteBuffer and MemorySegment types to view the data, and to view the structured representation</div></div><div><br></div><div>My usecase for MemorySegment and FFM API's is primarily for building databases (much like Johannes I believe)</div><div>It's very useful to be able to both print the hex view of database pages, and the structured segment view of pages -- this way I can see both the raw page data and visualize it as structs =)</div><div><br></div><div>For example, I'd like to be able to visualize stuff like this:</div><div><a href="https://github.com/GavinRay97/rosetta-db/blob/4ed46b104d22310a2c051e8d340611a868e37260/kotlin/app/src/main/kotlin/rosetta/db/App.kt#L497-L529">https://github.com/GavinRay97/rosetta-db/blob/4ed46b104d22310a2c051e8d340611a868e37260/kotlin/app/src/main/kotlin/rosetta/db/App.kt#L497-L529</a><br></div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 23, 2023 at 7:49 AM Pedro Lamarão <<a href="mailto:pedro.lamarao@prodist.com.br">pedro.lamarao@prodist.com.br</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Em seg., 23 de jan. de 2023 às 07:36, Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" target="_blank">maurizio.cimadamore@oracle.com</a>> escreveu:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>The HexDump functionality is, IMHO, more general, and I believe
it deserves a more central place in the JDK, rather than some
class in java.lang.foreign. In principle, users might want to
produce hexdumps of byte buffers, segments, byte arrays,
Collection<Byte>, ...<br></p>
<p>(as I write this, I realize that the same argument might be
applied to the memory inspection stuff, but I think it's a
defensible move to keep layouts and segments together, which we
have done in other places).</p>
<p>Which of the two pieces of functionalities you find yourselves
more in need of? Memory inspection (e.g. segment + layout ->
string), or hexdump? Or both?</p></div></blockquote><div><br></div><div>In my experience, without prejudice to adding a hexdumper to JDK, such things are quickly and easily born wherever necessary.</div><div>An inspector does not seem quick and easy to write while debugging, so perhaps it would bring more value to the table.<br></div><div>Maybe the inspector could actually do both and somehow include a hexdump as part of the inspection.</div></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Pedro Lamarão</div></div></div></div>
</blockquote></div>