[lldb-dev] Passing as argument an array in a function call

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Wed Dec 16 10:29:50 PST 2015


Looks like this is a MIPS specific bug, probably something we aren't handling (relocation type maybe?) in the JITed code we produce:

This works fine on the MacOSX lldb:

(lldb) expr -- uint32_t data[6] = {}; test1(data);  data
(uint32_t [6]) $0 = ([0] = 0x0000002a, [1] = 0x0000002b, [2] = 0x0000002c, [3] = 0x0000002d, [4] = 0x0000002e, [5] = 0x0000002f)




> On Dec 16, 2015, at 6:06 AM, Dean De Leo via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
> assume we wish to use the expression evaluator to invoke a function from lldb, setting the result into an array passed as parameter, e.g:
> 
> void test1(uint32_t* d) {
>    for(int i = 0; i < 6; i++){
>        d[i] = 42 + i;
>    }
> }
> 
> where the expected output should be d = {42,43,44,45,46,47}. However performing the following expression having as target android/mips32 returns:
> 
> (lldb) expr -- uint32_t data[6] = {}; test1(data);  data
> (uint32_t [6]) $4 = ([0] = 0, [1] = 2003456944, [2] = 44, [3] = 45, [4] = 2004491136, [5] = 47)
> 
> Is this an expected behaviour or a bug? I suspect the evaluator allocates the memory for data and releases once the expression has been executed?
> 
> If so, can you please advise what's the proper way to achieve the same functionality?
> 
> 
> Thanks,
> Dean
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list