[lldb-dev] Adding lldb support for ppc64le

2017-08-16 Thread Alexandre Yukio Yamashita via lldb-dev
Hi,

I am new to the lldb development and trying to add support for ppc64le.

Now, I am having some problems to handle the breakpoints.
In the file /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:1868, 
I am not able to get the PC address.

I created a new file (NativeRegisterContextLinux_ppc64le.cpp), modifying the 
file /lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp to 
implement a function to read the register values.

In the function DoReadRegisterValue 
(NativeRegisterContextLinux_ppc64le.cpp:856), I am trying to map the PC value 
using the NIP register. But the NIP is coming with a zero value.
Does anyone have an idea about why this is happening?
I am sending the code of the DoReadRegisterValue function below.

Alexandre.


Status NativeRegisterContextLinux_ppc64le::DoReadRegisterValue(
uint32_t offset, const char *reg_name, uint32_t size,
RegisterValue &value) {
Status error;

elf_gregset_t regs;
int regset = NT_PRSTATUS;
struct iovec ioVec;
struct pt_regs regs_p;
ioVec.iov_base = ®s;
ioVec.iov_len = sizeof regs;

bool isPc = strcmp(reg_name, "pc") == 0;
if (isPc) {
error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET,
m_thread.GetID(), ®set, ®s_p, sizeof regs_p);
} else {
error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET,
m_thread.GetID(), ®set, &ioVec, sizeof regs);
}

if (error.Success()) {
  ArchSpec arch;
  if (m_thread.GetProcess()->GetArchitecture(arch))
if (isPc) {
value.SetBytes(®s_p.nip, 8, arch.GetByteOrder());
} else {
value.SetBytes((void *) (((unsigned char *) (regs)) + offset), 8,
arch.GetByteOrder());
}
  else
error.SetErrorString("failed to get architecture");
}
  return error;
}

--
Alexandre Yukio Yamashita
Eldorado Research Institute
www.eldorado.org.br
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] Allocation memory is failing in PPC64le

2017-12-05 Thread Alexandre Yukio Yamashita via lldb-dev
Hi,

I am trying to implement the expression evaluation for PPC64le using JIT.
But the LLDB is failling to allocate memory when it tries to evaluate an 
expression.
A Thread Plan is being interrupted before LLDB tries to allocate memory.
How could I check why this plan is not finishing?
What functions should I implement to enable JIT?
I am sending the logs of the issue below.

Thanks.
Alexandre.

lldb 0x10013069c10: tid = 0x976: stop info = breakpoint 1.1 
(stop_id = 4)
lldb Process::RunThreadPlan(): execution interrupted: 
0x3fff70006ac0 Event: broadcaster = 0x100130167b8 (lldb.process), type = 
0x0001 (state-changed), data = { process = 0x10013016780 (pid = 2422), 
state = stopped} <1 threads> <0x0976 [ip 0x158c] breakpoint 1.1>
lldb Process::RunThreadPlan: ExecutionInterrupted - discarding 
thread plans up to 0x10013076210.
lldb Discarding thread plans for thread tid = 0x0976, up to 
0x10013076210
lldb 0x10013025c10 Broadcaster("lldb.process")::RestoreBroadcaster 
(about to pop listener("lldb.process.listener.run-thread-plan")=0x10012f85810)
lldb 0x10012f85810 
Listener::Clear('lldb.process.listener.run-thread-plan')
lldb 0x10012f85810 
Listener::~Listener('lldb.process.listener.run-thread-plan')
lldb ThreadPlanCallFunction(0x10013076210): DoTakedown called as 
no-op for thread 0x0976, m_valid: 1 complete: 1.

lldb Target::RemoveBreakpointByID (break_id = -3, internal = yes)

lldb Target::DisableBreakpointByID (break_id = -3, internal = yes)

lldb GDBRemoteCommunicationClient::SendGDBStoppointTypePacket() 
remove at addr = 0x13d0
lldb 0x10013017168 Communication::Write (src = 0x10012e7d318, 
src_len = 17) connection = 0x1001302e610
lldb 0x1001302e610 ConnectionFileDescriptor::Write (src = 
0x10012e7d318, src_len = 17)
lldb 0x1001302e610 ConnectionFileDescriptor::Write(fd = 7, src = 
0x10012e7d318, src_len = 17) => 17 (error = (null))
lldb this = 0x010013017168, dst = 0x3FFFED125FC8, dst_len = 
8192, timeout = 00 us, connection = 0x01001302E610
lldb this = 0x01001302E610, timeout = 00 us
lldb 0x1001302e610 ConnectionFileDescriptor::Read()  fd = 7, dst = 
0x3fffed125fc8, dst_len = 8192) => 6, error = (null)
lldb ProcessGDBRemote::DoAllocateMemory no direct stub support for 
memory allocation, and InferiorCallMmap also failed - is stub missing register 
context save/restore capability?
lldb Process::DoAllocateMemory (byte_size = 0x1000, permissions 
= rwx) => 0x
lldb AllocatedMemoryCache::AllocateMemory (byte_size = 0x0008, 
permissions = rwx) => 0x
lldb Process::CanJIT pid 2422 allocation test failed, CanJIT () is 
false: unable to allocate 4096 bytes of memory with permissions rwx
lldb AllocatedMemoryCache::DeallocateMemory (addr = 
0x) => 0



--
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br
+55 19 3757 3201 / +55 19 9 8336 5553
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] Issue: print std unique pointer

2018-02-27 Thread Alexandre Yukio Yamashita via lldb-dev
Hi,

LLDB is printing a empty value for unique pointers in PowerPC.
And I am investigating a solution for this problem.

The problem occurs because the ptr_obj variable has a empty value in 
Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:73.

I could solve it, changing this line 
Plugins/Language/CPlusPlus/LibStdcppTuple.cpp:68
from:
     if (name_str.startswith("std::_Tuple_impl<")) {
to:
     if (name_str.startswith("std::_Tuple_impl<") || 
name_str.startswith("_M_t") ) {

After this change, the test TestDataFormatterStdUniquePtr pass with success.
And the unique pointers are displayed correctly.

Is there a better solution for that?

Thanks.
Alexandre.


-- 
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br
+55 19 3757 3201 / +55 19 9 8336 5553
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Issue: print std unique pointer

2018-02-28 Thread Alexandre Yukio Yamashita via lldb-dev
All the test cases in TestDataFormatterStdUniquePtr were failing.
My std::unique_ptr layout is:

(std::unique_ptr >) iup = {
  (std::__uniq_ptr_impl >) _M_t = {
(std::tuple >) _M_t = {
  (std::_Tuple_impl<0, int *, std::default_delete >) 
std::_Tuple_impl<0, int *, std::default_delete > = {
(std::_Head_base<0, int *, false>) std::_Head_base<0, int *, false> 
= {
  (int *) _M_head_impl = 0x10041c20
}
  }
}
  }
}

It is showing "std::tuple >) _M_t"
instead of "std::_Tuple_impl<0, int *, std::default_delete >".

Em 27/02/2018 19:34, Greg Clayton escreveu:

Then the question becomes how can we identify the STL that is being used 
correctly so we can do the right thing. I worry that if std::unique_ptr isn't 
working that many many other STL things won't work as well. We are tuned for a 
specific STL



On Feb 27, 2018, at 2:12 PM, Pavel Labath via lldb-dev 
<mailto:lldb-dev@lists.llvm.org> wrote:

This probably isn't arch-dependent. More likely you just have a
different version of libstdc++. Can you share how the std::unique_ptr
layout looks like for you. This is how my std::unique_ptr looks like
(from libstdc++.so.6.0.22):

(lldb) fr var X -R -T
(std::unique_ptr >) X = {
 (std::unique_ptr >::__tuple_type) _M_t = {
   (std::_Tuple_impl<0, int *, std::default_delete >)
std::_Tuple_impl<0, int *, std::default_delete > = {
 (std::_Head_base<0, int *, false>) std::_Head_base<0, int *, false> = {
   (int *) _M_head_impl = 0x55768c20
 }
   }
 }
}

On 27 February 2018 at 12:26, Alexandre Yukio Yamashita via lldb-dev
<mailto:lldb-dev@lists.llvm.org> wrote:


Hi,

LLDB is printing a empty value for unique pointers in PowerPC.
And I am investigating a solution for this problem.

The problem occurs because the ptr_obj variable has a empty value in
Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:73.

I could solve it, changing this line
Plugins/Language/CPlusPlus/LibStdcppTuple.cpp:68
from:
if (name_str.startswith("std::_Tuple_impl<")) {
to:
if (name_str.startswith("std::_Tuple_impl<") ||
name_str.startswith("_M_t") ) {

After this change, the test TestDataFormatterStdUniquePtr pass with success.
And the unique pointers are displayed correctly.

Is there a better solution for that?

Thanks.
Alexandre.


--
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br<http://www.eldorado.org.br>
+55 19 3757 3201 / +55 19 9 8336 5553
___
lldb-dev mailing list
lldb-dev@lists.llvm.org<mailto:lldb-dev@lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


___
lldb-dev mailing list
lldb-dev@lists.llvm.org<mailto:lldb-dev@lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev





--
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br<http://www.eldorado.org.br>
+55 19 3757 3201 / +55 19 9 8336 5553
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Issue: print std unique pointer

2018-03-02 Thread Alexandre Yukio Yamashita via lldb-dev
Implemented a fix in: https://reviews.llvm.org/D44015
Could you please review it?


Em 28/02/2018 16:07, Pavel Labath escreveu:
> I think this is the interesting part: std::__uniq_ptr_impl std::default_delete >
>
> There is no such type in the example I posted. It looks like the
> implementation of std::unique_ptr changed, and they added an extra
> member object. This tells me the fix should be in the data formatter
> for std::unique_ptr and not std::tuple (which makes sense, because
> your std::tuple tests are still passing (?)). We should detect the new
> layout and format based on that. It would also be good to know in
> which libstdc++ version this changed, so we can leave a note to future
> selves about when can this be cleaned up.
>
> On 28 February 2018 at 05:25, Alexandre Yukio Yamashita
>  wrote:
>> All the test cases in TestDataFormatterStdUniquePtr were failing.
>> My std::unique_ptr layout is:
>>
>>  (std::unique_ptr >) iup = {
>>(std::__uniq_ptr_impl >) _M_t = {
>>  (std::tuple >) _M_t = {
>>(std::_Tuple_impl<0, int *, std::default_delete >)
>> std::_Tuple_impl<0, int *, std::default_delete > = {
>>  (std::_Head_base<0, int *, false>) std::_Head_base<0, int *,
>> false> = {
>>(int *) _M_head_impl = 0x10041c20
>>  }
>>}
>>  }
>>}
>>  }
>>
>> It is showing "std::tuple >) _M_t"
>> instead of "std::_Tuple_impl<0, int *, std::default_delete >".
>>
>>
>> Em 27/02/2018 19:34, Greg Clayton escreveu:
>>
>> Then the question becomes how can we identify the STL that is being used
>> correctly so we can do the right thing. I worry that if std::unique_ptr
>> isn't working that many many other STL things won't work as well. We are
>> tuned for a specific STL
>>
>> On Feb 27, 2018, at 2:12 PM, Pavel Labath via lldb-dev
>>  wrote:
>>
>> This probably isn't arch-dependent. More likely you just have a
>> different version of libstdc++. Can you share how the std::unique_ptr
>> layout looks like for you. This is how my std::unique_ptr looks like
>> (from libstdc++.so.6.0.22):
>>
>> (lldb) fr var X -R -T
>> (std::unique_ptr >) X = {
>>   (std::unique_ptr >::__tuple_type) _M_t = {
>> (std::_Tuple_impl<0, int *, std::default_delete >)
>> std::_Tuple_impl<0, int *, std::default_delete > = {
>>   (std::_Head_base<0, int *, false>) std::_Head_base<0, int *, false> = {
>> (int *) _M_head_impl = 0x55768c20
>>   }
>> }
>>   }
>> }
>>
>> On 27 February 2018 at 12:26, Alexandre Yukio Yamashita via lldb-dev
>>  wrote:
>>
>> Hi,
>>
>> LLDB is printing a empty value for unique pointers in PowerPC.
>> And I am investigating a solution for this problem.
>>
>> The problem occurs because the ptr_obj variable has a empty value in
>> Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:73.
>>
>> I could solve it, changing this line
>> Plugins/Language/CPlusPlus/LibStdcppTuple.cpp:68
>> from:
>>  if (name_str.startswith("std::_Tuple_impl<")) {
>> to:
>>  if (name_str.startswith("std::_Tuple_impl<") ||
>> name_str.startswith("_M_t") ) {
>>
>> After this change, the test TestDataFormatterStdUniquePtr pass with success.
>> And the unique pointers are displayed correctly.
>>
>> Is there a better solution for that?
>>
>> Thanks.
>> Alexandre.
>>
>>
>> --
>> Alexandre Yukio Yamashita (DSB)
>> Instituto de Pesquisas Eldorado
>> www.eldorado.org.br
>> +55 19 3757 3201 / +55 19 9 8336 5553
>> ___
>> lldb-dev mailing list
>> lldb-dev@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>
>> ___
>> lldb-dev mailing list
>> lldb-dev@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>
>>
>> --
>> Alexandre Yukio Yamashita (DSB)
>> Instituto de Pesquisas Eldorado
>> www.eldorado.org.br
>> +55 19 3757 3201 / +55 19 9 8336 5553

-- 
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br
+55 19 3757 3201 / +55 19 9 8336 5553
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] Add PPC64le support for LLDB

2018-05-23 Thread Alexandre Yukio Yamashita via lldb-dev
Hi,

My team worked on porting LLDB for PPC64le.
Now, LLDB is working with the features: breakpoints, watchpoints, 
read/write registers, backtrace, JIT, stepping, and core dump.
We would like to make this port available for the community.
How can I add this information on the official LLDB site?

Thanks.
Alexandre.


-- 
Alexandre Yukio Yamashita (DSB)
Instituto de Pesquisas Eldorado
www.eldorado.org.br
+55 19 3757 3201 / +55 19 9 8336 5553
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev