[lldb-dev] Target::ReadMemory query

Matthew Gardiner mg11 at csr.com
Thu Jun 5 23:14:14 PDT 2014


I have a question regarding some of the logic of "Target::ReadMemory".
I'm looking at this code:

(in my copy this is line 1314)
     if (!addr.IsSectionOffset())
         SectionLoadList &section_load_list = GetSectionLoadList();
         if (section_load_list.IsEmpty())
             // No sections are loaded, so we must assume
             // we are not running yet and anything we are given is
             // a file address.
             file_addr = addr.GetOffset();
             // "addr" doesn't have a section, so its offset is the
             //file address
             m_images.ResolveFileAddress (file_addr,    resolved_addr); 

             // We have at least one section loaded. This can be becuase
             // we have manually loaded some sections with
             // "target modules load ..."
             // or because we have have a live process that has
             // sections loaded
             // through the dynamic loader
             load_addr = addr.GetOffset();
             // "addr" doesn't have a section,
             //so its offset is the load address
             section_load_list.ResolveLoadAddress (load_addr, 

My question is why is section_load_list.IsEmpty() used (according to the 
comment below it) to deduce that the target is not running?

Further down the Target::ReadMemory I see the invocation 
ProcessIsValid() to discover the reverse. So why don't we just use

if(!ProcessIsValid()) instead of section_load_list.IsEmpty() earlier on 
in this function?

(To be clear: I'm looking at this as I'm trying to debug a 
loaded/running embedded target, over a gdb-remote, and my debug of the 
lldb session reports section_load_list.IsEmpty(). Possibly another 
issue, yes, but I think my question above still applies.)

I'm wondering if anyone in lldb-dev can comment on this?


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.

More information about the lldb-dev mailing list