[lldb-dev] RFC: Support for unwinding on windows

2019-08-23 Thread Pavel Labath via lldb-dev

Hello everyone,

after a short recess, I have started to resume work on the breakpad 
symbols project. The project is "nearly" finished, but there is one more 
thing remaining to be done. This is to support stack unwinding for 32 
bit windows targets.


The unwinding info in breakpad is represented differently in breakpad, 
because unwinding on 32bit windows is... different. For example, an 
"unwind plan" for a typical win32 function would be described by a 
string like "$T0 .raSearch = $eip $TO ^ = $esp $TO 4 + =". Now, this 
string is basically a program in a special postfix language, and if you 
look closely, you can recognise fragments like "$eip = deref(T0)", and 
"$esp = $T0 + 4", which look fairly typical. However, there's this 
".raSearch" bit that is unlike anything we have in lldb at the moment.


The way that .raSearch works is that it asks the debugger to look around 
the stack for something that looks like a plausible return address, and 
then return the address of that return address. Now, the reason that 
this works (mostly) reliably is that on windows, the debug info contains 
information about the size of functions' stack frames -- the number of 
bytes taken up by local variables, arguments, etc. Armed with this 
knowledge, the debugger can skip portions of the stack that definitely 
do not hold the return address and can e.g. avoid confusing function 
pointer arguments for the return addresses.


The way I propose to implement this in lldb is:
- SymbolFile: add two new APIs to get the number of stack bytes used by 
a function for locals and the size of function arguments. Two functions 
are needed because (as usual) the function arguments are considered a 
part of the callers stack frame, and so the number of arguments for a 
function is relevant not when unwinding this function, but for the 
unwinding of its caller. SymbolFileBreakpad (and later SymbolFilePDB -- 
Adrian is working on that) will implement these function to return the 
appropriate values.
- UnwindPlan: add a new value (isFoundHeuristically) to the CFA kind 
enumeration. When encountering this value, the unwinder will search the 
stack for a value that looks like a pointer to a known code section. It 
will use the above SymbolFile APIs to skip over uninteresting parts of 
the stack. SymbolFileBreakpad will search for the known usage patterns 
of the .raSearch keyword and generate appropriate unwind plans (i.e. set 
CFA to "isFoundHeuristically", and appropriate rules for the other 
registers)


I've created a couple of patches which demonstrate how this could be 
implemented. The most interesting one is 
, which is WIP, but I should be 
sufficient for demonstration purposes. 
, and  
are also needed for this patch to work, but they are largely 
uninteresting from an general unwind perspective.


Let me know if you have any questions, concerns, suggestions, etc.

Pavel
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] [9.0.0 Release] Please help writing release notes

2019-08-23 Thread Hans Wennborg via lldb-dev
Hi everyone,

The end of the release process is getting close, and as usual I'd like
to ask you all to help writing release notes.

As you can see from the release notes for rc2 here:
https://prereleases.llvm.org/9.0.0/#rc2 there is plenty of room for
more notes :-)

When the release happens, the first thing people look at are these
notes, so it's a great opportunity to show what we've been doing for
the past six months.

If you know anything that's worth adding, please commit to the release
notes directly on the branch, or send me a patch, or even a plain
email with some text and I'll happily commit for you.

I don't know whether it's possible to commit to the release branch
from the Git monorepo, but it's easy to do with Subversion; for
example:

$ svn co --non-recursive
https://llvm.org/svn/llvm-project/llvm/branches/release_90/docs/
llvm90docs
$ cd llvm90docs
(edit ReleaseNotes.rst)
$ svn commit

Many thanks,
Hans
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] [RFC] Fast Conditional Breakpoints (FCB)

2019-08-23 Thread Ismail Bennani via lldb-dev
> On Aug 22, 2019, at 11:00 PM, Pavel Labath  wrote:
> 
> On 23/08/2019 00:58, Ismail Bennani via lldb-dev wrote:
>> Hi Greg,
>> Thanks for your suggestion!
>>> On Aug 22, 2019, at 3:35 PM, Greg Clayton  wrote:
>>> 
>>> Another possibility is to have the IDE insert NOP opcodes for you when you 
>>> write a breakpoint with a condition and compile NOPs into your program.
>>> 
>>> So the flow is:
>>> - set a breakpoint in IDE
>>> - modify breakpoint to add a condition
>>> - compile and debug, the IDE inserts NOP instructions at the right places
>> We’re trying to avoid rebuilding every time we want to debug, but I’ll keep
>> this in mind as an eventual fallback.
> 
> A slight variation on that feature would be to just have the compiler 
> guarantee that there will always be enough space between two jump targets for 
> us to insert a trampoline jump. One way to guarantee that would be to align 
> all jump targets to 16-byte boundaries (on x86 anyway).


One of my next task is to add some instrumentation that will tell if it’s safe 
to
set the fast conditional breakpoint at the desired location.

I already thought of some scenarios in the RFC, where we’ll need to do some 
extra
work to be able to insert a FCB.

> 
> I say this because I have a vague recollection that some of the more exotic 
> llvm backends (webassembly?) may already have such a requirement, albeit for 
> different reasons (to do with being able to statically analyze control flow), 
> so the code for doing this might already be there, and maybe all it would 
> take is a little tinkering with the codegen options to enable it.

I’ll take a closer look at those.

> 
> Unfortunately, I don't remember the details of this, but someone on this list 
> might…
> 
> pl

Thanks,

Ismail.



___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Anybody using the GUI?

2019-08-23 Thread Jonas Devlieghere via lldb-dev
Hi Greg,

We're more than a year later and I haven't seen any development on the
GUI. While I personally thing this could be a really cool feature,
I've never been able to use it because it's missing too many thing to
be useful for now. When I talk to people that know about this feature,
I hear either frustration or disappointment that it doesn't work
(yet). I (personally) haven't found anyone that is actively using it.
As such, can we remove it until we have resources to do it right and
provide our users with something they can rely on?

Thanks,
Jonas

On Wed, Apr 11, 2018 at 11:47 AM Greg Clayton via lldb-dev
 wrote:
>
> And yes many people I know are using this including myself.
>
> > On Apr 11, 2018, at 11:08 AM, Davide Italiano  wrote:
> >
> > Good day.
> > While trying to implement a command in lldb I noticed lldb has this
> > awesome `gui` command that opens an ncurses GUI.
> > I find it really useful and I wanted to play with it a bit, but I
> > wasn't really able to get it working.
> > In particular, I tried to press enter on `target create` or `attach`
> > but nothing happens.
> >
> > Greg, as you wrote the original implementation, can you please explain
> > how this is supposed to work? Are you actively interested in
> > maintaining this mode?
> >
> > Thanks!
> >
> > --
> > Davide
>
> ___
> 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
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Anybody using the GUI?

2019-08-23 Thread Jim Ingham via lldb-dev
From what I can tell the main thing this is missing is a Console window.  I 
imagine hosting a full console window inside a ncurses sub window would be a 
pain if there isn't a pre-built widget for that.  But maybe it would be easier 
to open another terminal window and connect the debuggers I/O channels to that 
console.  We already know how to open another terminal - we use that for the 
"launch in a separate terminal".  So you could reuse that.  That might be a 
cheap way to fill in the main missing piece.

Jim


> On Aug 23, 2019, at 4:36 PM, Jonas Devlieghere via lldb-dev 
>  wrote:
> 
> Hi Greg,
> 
> We're more than a year later and I haven't seen any development on the
> GUI. While I personally thing this could be a really cool feature,
> I've never been able to use it because it's missing too many thing to
> be useful for now. When I talk to people that know about this feature,
> I hear either frustration or disappointment that it doesn't work
> (yet). I (personally) haven't found anyone that is actively using it.
> As such, can we remove it until we have resources to do it right and
> provide our users with something they can rely on?
> 
> Thanks,
> Jonas
> 
> On Wed, Apr 11, 2018 at 11:47 AM Greg Clayton via lldb-dev
>  wrote:
>> 
>> And yes many people I know are using this including myself.
>> 
>>> On Apr 11, 2018, at 11:08 AM, Davide Italiano  wrote:
>>> 
>>> Good day.
>>> While trying to implement a command in lldb I noticed lldb has this
>>> awesome `gui` command that opens an ncurses GUI.
>>> I find it really useful and I wanted to play with it a bit, but I
>>> wasn't really able to get it working.
>>> In particular, I tried to press enter on `target create` or `attach`
>>> but nothing happens.
>>> 
>>> Greg, as you wrote the original implementation, can you please explain
>>> how this is supposed to work? Are you actively interested in
>>> maintaining this mode?
>>> 
>>> Thanks!
>>> 
>>> --
>>> Davide
>> 
>> ___
>> 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
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Anybody using the GUI?

2019-08-23 Thread Nico Weber via lldb-dev
I've used it every now and then. It seems to work well enough for simple
things (stepping through assembly and looking at registers iirc – but maybe
it was stepping through code and looking at variables).

On Fri, Aug 23, 2019 at 7:36 PM Jonas Devlieghere via lldb-dev <
lldb-dev@lists.llvm.org> wrote:

> Hi Greg,
>
> We're more than a year later and I haven't seen any development on the
> GUI. While I personally thing this could be a really cool feature,
> I've never been able to use it because it's missing too many thing to
> be useful for now. When I talk to people that know about this feature,
> I hear either frustration or disappointment that it doesn't work
> (yet). I (personally) haven't found anyone that is actively using it.
> As such, can we remove it until we have resources to do it right and
> provide our users with something they can rely on?
>
> Thanks,
> Jonas
>
> On Wed, Apr 11, 2018 at 11:47 AM Greg Clayton via lldb-dev
>  wrote:
> >
> > And yes many people I know are using this including myself.
> >
> > > On Apr 11, 2018, at 11:08 AM, Davide Italiano 
> wrote:
> > >
> > > Good day.
> > > While trying to implement a command in lldb I noticed lldb has this
> > > awesome `gui` command that opens an ncurses GUI.
> > > I find it really useful and I wanted to play with it a bit, but I
> > > wasn't really able to get it working.
> > > In particular, I tried to press enter on `target create` or `attach`
> > > but nothing happens.
> > >
> > > Greg, as you wrote the original implementation, can you please explain
> > > how this is supposed to work? Are you actively interested in
> > > maintaining this mode?
> > >
> > > Thanks!
> > >
> > > --
> > > Davide
> >
> > ___
> > 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
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev