Page MenuHomePhabricator

RenderScript command for printing allocation contents.

Authored by EwanCrawford on Oct 13 2015, 8:22 AM.



This patch adds the command 'language renderscript allocation dump <ID>' for printing the contents of a RS allocation.
Displaying the coordinate of each element as well as its formatted value

e.g (lldb) language renderscript allocation dump 1

Data (X, Y, Z):
(0, 0, 0) = {0 1}
(1, 0, 0) = {2 3}
(2, 0, 0) = {4 5}

A --file <filename> option is also included, since for large allocations it may be more helpful to view this text as a file.

Diff Detail


Event Timeline

EwanCrawford retitled this revision from to RenderScript command for printing allocation contents..
EwanCrawford updated this object.
EwanCrawford added reviewers: clayborg, jingham.
EwanCrawford set the repository for this revision to rL LLVM.
brucem added a subscriber: brucem.Oct 13 2015, 8:25 AM

I don't know much about this, but would it make sense for this to be using any of the Value / SBValue and data formatter infrastructure?

Hi Bruce,

I'm mapping rs types to data formatters in the struct RenderScriptRuntime::AllocationDetails::RSTypeToFormat on line RenderScriptRuntime.cpp:259.

Then using a DataExtractor to print using those formats on RenderScriptRuntime.cpp:1830

Is there another way you would suggest?

clayborg accepted this revision.Oct 13 2015, 12:49 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Oct 13 2015, 12:49 PM
This revision was automatically updated to reflect the committed changes.
labath added a subscriber: labath.Oct 14 2015, 3:10 AM

Hi Ewan,

this commit introduces a new warning:

lldb/source/Commands/CommandObjectMemory.cpp:1502:21: warning: enumeration value 'eFormatVectorOfFloat16' not handled in switch [-Wswitch]
            switch (m_format_options.GetFormat())

Also, it breaks

  File "/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-smart-array/", line 19, in test_with_run_command
  File "/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-smart-array/", line 279, in data_formatter_commands
  File "/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/", line 2794, in expect
    msg if msg else EXP_MSG(str, exe))
AssertionError: False is not True : '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}' returns expected result

Could you look into these issues? If you can't look into it now, shall we revert it until you get a chance to have a look?

Hi Pavel,
Thanks for letting me know, I'll look into it now.


I have reverted this as all the bots were getting red. In the test, variable was getting printed as [{},{},{},{},{},{},{}] instead of {78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}. Please resubmit once the issue is resolved.

No bother, thanks for reverting

Is there any reason why we need a special command here?

Are these allocations not bound to any user-visible variable, such that one could get the same result by using our existing data inspection commands (expression, frame variable, ...) with some data formatter support?

Unfortunately there isn't a user-visible variable for the allocation. Information regarding the allocation as a whole is maintained by the runtime.

Within a RS kernel invocation the user only has access to the raw data at a specific cell in the allocation, which is available for data inspection.
More information about the allocation can be acquired within a kernel, but only by querying API functions.