Re: [Lldb-commits] [PATCH] D111409: proposed support for Java interface to Scripting Bridge

2021-11-11 Thread David Millar via lldb-commits
Am sorry I can't commit build resources, but am certainly willing to commit 
time to solving test problems.  In a very general sense, I think our project 
(Ghidra) will effectively be a test platform for issues with the Java bindings 
to SWIG.


With regard to the set-up for testing, I have noticed differences in behavior 
between the "ninja check-lldb-xxx" suite-testing environment, the llvm-lit test 
sets, and actual lldb runs / individual tests.  I believe (I should never say 
this out loud, but...) the current code handles these environments correctly.


The Java scripting framework requires the ability to find two things:  the Java 
install (and within it libjvm) and the SWIG.jar built from the JNI wrappers.  
If either LD_LIBRARY_PATH or JAVA_HOME is set in whichever environment is in 
use, the code should be able to find libjvm.  If CLASSPATH includes the 
SWIG.jar or we're running out of build, finding it should be handled.  Libjvm 
is loaded dynamically, so the inclusion of my code "should" have no effect on 
environments without Java installed.


I was thinking I would also spend a couple of days isolating the swig logic in 
case supporting the Java interface becomes untenable for you.  Am hoping I can 
pare it down so that our users could point-and-click at an existing lldb repo, 
without necessarily having to build llvm/lldb.


Best, Dave


From: Raphael Isemann via Phabricator 
Sent: Thursday, November 11, 2021 7:23:11 AM
To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
medismail.benn...@gmail.com; jo...@devlieghere.com; tedw...@quicinc.com; 
jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
bruce.mitche...@gmail.com; david.spick...@linaro.org; 
quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
serhiy.re...@gmail.com; liburd1...@outlook.com
Cc: pa...@labath.sk; mgo...@gentoo.org
Subject: [PATCH] D111409: proposed support for Java interface to Scripting 
Bridge

teemperor added a comment.

In D111409#3124194 , @labath wrote:

> In D111409#3124075 , @teemperor 
> wrote:
>
>>> Are you asking for dedicated physical resources for running nightly builds?
>>
>> I don't think any of the current bots have a Java installation so I think 
>> it's either that or we get someone with a bot to setup the required Java 
>> installation.
>
> I don't have a problem with installing the necessary packages on the bot I 
> manage, but I cannot subscribe to tracking down any failures (or flaky 
> tests!) for this configuration (and, in my experience, any new feature like 
> this is going to have flaky tests). Flaky tests (probably just one) are the 
> reason that lua integration is not enabled on this bot.

Sure, I think it should anyway not be up to any bot owner to track down flaky 
tests. And that nested_sessions lua test is anyway randomly failing everywhere 
from what I know.

>> FWIW, if no one wants to host a bot for this then I won't mind testing this 
>> in own CI , but I am not using buildbot so we'll 
>> have to see if that is acceptable for the community (I could also migrate it 
>> to buildbot, but the buildbot interface is just painful to use and I would 
>> prefer not to).
>
> I would rather not proliferate test infrastructures.
>
> I'm not sure which pain points are you referring to, but setting up a 
> buildbot instance is a lot simpler these days than it used to be (in 
> particular, you don't need to track down and install any outdated packages).

It's not the setup, it's just that the lab.llvm.org interface is far less 
usable than Jenkins for tracking down regressions in tests (and Jenkins is 
already not great, so that says something). But that's just my personal 
preference and I agree that lab.llvm.org should be the central place for 
infrastructure.

Anyway, if @labath can run them on his fancy build bot then I would prefer that 
over having it on my bot (because I pay out of my own pocket and CPU cycles are 
$$$).


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111409/new/

https://reviews.llvm.org/D111409

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


Re: [Lldb-commits] [PATCH] D111409: proposed support for Java interface to Scripting Bridge

2021-11-10 Thread David Millar via lldb-commits
Hi Jonas,


Apologies for the non-build - I did a fetch/rebase this morning before creating 
the patch.  Do I need to be on a different branch re StringRef vs ConstString?  
(Have seen that discussion in passing but confess I did not follow it in 
detail.)  Any pointers appreciated.


Re testing, I basically duplicated the test set from Lua and ran it using 
"ninja check-lldb-unit" and "ninja check-lldb-shell".  I'm not really 
conversant with your testing infrastructure.  Can you point me to something 
that might be suggest what I'd need to do to generate a bot?  I'll give it a 
shot if I have a starting point.


Also am happy to maintain the code in general and have a few folks in our 
project that can backstop me in case I get run over by a bus or something.  


Best,

Dave


From: Jonas Devlieghere via Phabricator 
Sent: Wednesday, November 10, 2021 1:57:51 PM
To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
teempe...@gmail.com; medismail.benn...@gmail.com; tedw...@quicinc.com; 
jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
bruce.mitche...@gmail.com; david.spick...@linaro.org; 
quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
serhiy.re...@gmail.com; liburd1...@outlook.com
Cc: mgo...@gentoo.org
Subject: [PATCH] D111409: proposed support for Java interface to Scripting 
Bridge

JDevlieghere added a comment.

Hi David, this looks really comprehensive. As far as the code is concerned, it 
has all the parts that we'd want to support another scripting language in LLDB. 
That leaves us with the last remaining questions:

- Testing: having a bot that actually builds & tests this configuration.
- Maintainership: having a commitment from you (or someone else) to maintain 
this code.

Are you willing and able to sign up for those things?

PS: I installed Java and applied your patch on top-of-tree. Things didn't built 
because of the recent change to the plugin manager that now expects 
`StringRef`s instead of `ConstString`s. Please let me know if you've rebased 
the patch and I'd love to give it a try.




Comment at: lldb/cmake/modules/FindJavaAndSwig.cmake:13
+find_package(Java 11.0)
+find_package(JNI REQUIRED)
+if(JAVA_FOUND AND SWIG_FOUND)

This can't be `REQUIRED` because that will fail the CMake configuration stage 
when Java isn't found which is not what you want when doing autodetection (the 
default). Making it required is handled at a higher level for `FindJavaAndSwig` 
as a whole.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111409/new/

https://reviews.llvm.org/D111409

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


Re: [Lldb-commits] [PATCH] D111409: proposed support for Java interface to Scripting Bridge

2021-10-08 Thread David Millar via lldb-commits
Just to clarify my use case:  I am one of the developers for a 
reverse-engineering tool called Ghidra.  Part of the tool is debugging-support 
to allow cross-over between dynamic and static analysis.  We currently support 
windbg/kd, the gcc MI2 interface, and direct Java debugging.  I have a working 
prototype for lldb, but it requires users to patch and rebuild lldb, which may 
be a heavy lift for some.  While it falls outside of my use case, I am quite 
willing to attempt implementing pieces 2 & 3 from Mr. Ingham's post.


From: Jim Ingham via Phabricator 
Sent: Friday, October 8, 2021 2:31:13 PM
To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
teempe...@gmail.com; medismail.benn...@gmail.com; jo...@devlieghere.com; 
tedw...@quicinc.com; jmole...@apple.com; syaghm...@apple.com; 
jing...@apple.com; v...@apple.com; boris.ulasev...@gmail.com; 
lldb-commits@lists.llvm.org; h.imai@nitech.jp; bruce.mitche...@gmail.com; 
david.spick...@linaro.org; quic_soura...@quicinc.com; 
djordje.todoro...@syrmia.com; serhiy.re...@gmail.com; liburd1...@outlook.com
Cc: mgo...@gentoo.org
Subject: [PATCH] D111409: proposed support for Java interface to Scripting 
Bridge

jingham added a comment.

Support for a scripting language in lldb has three distinct pieces.

1. Making the SB API's available to the scripting languages
2. Adding all the callbacks so the scripting language can be used for 
breakpoint callbacks, data formatters, etc.
3. Adding a REPL for that language to the "script" command

This patch does #1, but not #2 & #3.  Do we care about whether new scripting 
languages will be able to provide the full "scripting language" experience?  
Does there need to be some plan for this before we add on the task of 
supporting the language?  Maybe it's okay to say "a REPL's too hard, and not 
worth it" but we should have a plan for adding in the callback interfaces?  Do 
we want to have somewhere you can advertise levels of support?  I would be sad 
to spend some time using a scripting language for lldb only to find it doesn't 
allow me to write breakpoint callbacks, for instance.

This is language #3 so it seems like a fit time to discuss this...


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111409/new/

https://reviews.llvm.org/D111409

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


Re: [Lldb-commits] [PATCH] D111409: proposed support for Java interface to Scripting Bridge

2021-10-08 Thread David Millar via lldb-commits
I'm not sure I understand your testing strategy, in particular how it applies 
to the existing Lua and Python extensions.  I am looking at the files in 
lldb/unittests/ScriptInterpreter/Lua  Do you execute test from native 
Lua/Python environments or through C wrappers-only?  You mentioned a bot - is 
that code in the main repository?


From: Raphael Isemann via Phabricator 
Sent: Friday, October 8, 2021 11:24:10 AM
To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
medismail.benn...@gmail.com; jo...@devlieghere.com; tedw...@quicinc.com; 
jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
bruce.mitche...@gmail.com; david.spick...@linaro.org; 
quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
serhiy.re...@gmail.com; liburd1...@outlook.com
Cc: mgo...@gentoo.org
Subject: [PATCH] D111409: proposed support for Java interface to Scripting 
Bridge

teemperor added a comment.

No problem, first time using Phabricator is always a bit confusing. You can 
just do a `git diff -U99 > ~/java-patch.diff`, click the "Update Diff" 
button on the top right of this website and then select *just* this diff file 
that contains your changes. Phabricator will render the diff properly for you 
(-> it will hide all the diff context by default). There is need to attach a 
separate diff file or anything else (users can just download the diff you 
uploaded).

Regarding the tests: We would essentially just need some basic test that 
exercises the new API a bit so that we know this works. The test code itself 
will be straightforward, but we would need a nice way to (automatically) find 
the system JRE and then set it up to be able to run the test code.

In D111409#3051140 , @d-millar wrote:

> Am obviously brand new to your process and a bit of an old dog when it comes 
> to learning new tricks.  Would you prefer I make a new submission with the 
> -U99 diff?   Also, am more than willing to help with the Java tests if 
> that would be useful.
>
> 
>
> From: Raphael Isemann via Phabricator 
> Sent: Friday, October 8, 2021 10:46:50 AM
> To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
> medismail.benn...@gmail.com; jo...@devlieghere.com; tedw...@quicinc.com; 
> jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
> boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
> bruce.mitche...@gmail.com; david.spick...@linaro.org; 
> quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
> serhiy.re...@gmail.com; liburd1...@outlook.com
> Cc: mgo...@gentoo.org
> Subject: [PATCH] D111409 : proposed support 
> for Java interface to Scripting Bridge
>
> teemperor added a comment.
>
> In D111409#3051110  
> https://reviews.llvm.org/D111409#3051110, @d-millar wrote:
>
>> Apologies for the inclusion of that last file "patch" - that is the "git 
>> diff -U999" result, should that be useful.
>
> You can just upload that diff file and Phabricator will display it properly. 
> There is no need to include the raw diff as part of the patch itself (it just 
> makes this diff 100 times larger than it needs to be) :)
>
> Anyway, I think this seems like a reasonable thing to have. We have to figure 
> out though how we can properly set up some Java tests for this and it would 
> be nice if we also find a bot that could actually run the tests for us.
>
>
>
>
> Comment at: lldb/bindings/java/CMakeLists.txt:3
> + * IP: Apache License 2.0 with LLVM Exceptions
> + */
>
> +add_custom_command(
> 
>
> I don't think CMake accepts this as a comment and I think we anyway don't put 
> license headers in CMake scripts.
>
>
>
>
> Comment at: lldb/source/API/CMakeLists.txt:84
>
>   SBTrace.cpp
>
> +  SBTraceOptions.cpp
>
>   SBType.cpp
>
> 
>
> I think this is some conflict with one of the SBTrace patches.
>
> Repository:
>
>   rLLDB LLDB
>
> CHANGES SINCE LAST ACTION
>
>   https://reviews.llvm.org/D111409/new/
>
> https://reviews.llvm.org/D111409




Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111409/new/

https://reviews.llvm.org/D111409

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


Re: [Lldb-commits] [PATCH] D111409: proposed support for Java interface to Scripting Bridge

2021-10-08 Thread David Millar via lldb-commits
Merde - I followed you instructions but forgot to run clang-format.  Give me a 
minute


From: Raphael Isemann via Phabricator 
Sent: Friday, October 8, 2021 11:24:10 AM
To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
medismail.benn...@gmail.com; jo...@devlieghere.com; tedw...@quicinc.com; 
jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
bruce.mitche...@gmail.com; david.spick...@linaro.org; 
quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
serhiy.re...@gmail.com; liburd1...@outlook.com
Cc: mgo...@gentoo.org
Subject: [PATCH] D111409: proposed support for Java interface to Scripting 
Bridge

teemperor added a comment.

No problem, first time using Phabricator is always a bit confusing. You can 
just do a `git diff -U99 > ~/java-patch.diff`, click the "Update Diff" 
button on the top right of this website and then select *just* this diff file 
that contains your changes. Phabricator will render the diff properly for you 
(-> it will hide all the diff context by default). There is need to attach a 
separate diff file or anything else (users can just download the diff you 
uploaded).

Regarding the tests: We would essentially just need some basic test that 
exercises the new API a bit so that we know this works. The test code itself 
will be straightforward, but we would need a nice way to (automatically) find 
the system JRE and then set it up to be able to run the test code.

In D111409#3051140 , @d-millar wrote:

> Am obviously brand new to your process and a bit of an old dog when it comes 
> to learning new tricks.  Would you prefer I make a new submission with the 
> -U99 diff?   Also, am more than willing to help with the Java tests if 
> that would be useful.
>
> 
>
> From: Raphael Isemann via Phabricator 
> Sent: Friday, October 8, 2021 10:46:50 AM
> To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
> medismail.benn...@gmail.com; jo...@devlieghere.com; tedw...@quicinc.com; 
> jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
> boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
> bruce.mitche...@gmail.com; david.spick...@linaro.org; 
> quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
> serhiy.re...@gmail.com; liburd1...@outlook.com
> Cc: mgo...@gentoo.org
> Subject: [PATCH] D111409 : proposed support 
> for Java interface to Scripting Bridge
>
> teemperor added a comment.
>
> In D111409#3051110  
> https://reviews.llvm.org/D111409#3051110, @d-millar wrote:
>
>> Apologies for the inclusion of that last file "patch" - that is the "git 
>> diff -U999" result, should that be useful.
>
> You can just upload that diff file and Phabricator will display it properly. 
> There is no need to include the raw diff as part of the patch itself (it just 
> makes this diff 100 times larger than it needs to be) :)
>
> Anyway, I think this seems like a reasonable thing to have. We have to figure 
> out though how we can properly set up some Java tests for this and it would 
> be nice if we also find a bot that could actually run the tests for us.
>
>
>
>
> Comment at: lldb/bindings/java/CMakeLists.txt:3
> + * IP: Apache License 2.0 with LLVM Exceptions
> + */
>
> +add_custom_command(
> 
>
> I don't think CMake accepts this as a comment and I think we anyway don't put 
> license headers in CMake scripts.
>
>
>
>
> Comment at: lldb/source/API/CMakeLists.txt:84
>
>   SBTrace.cpp
>
> +  SBTraceOptions.cpp
>
>   SBType.cpp
>
> 
>
> I think this is some conflict with one of the SBTrace patches.
>
> Repository:
>
>   rLLDB LLDB
>
> CHANGES SINCE LAST ACTION
>
>   https://reviews.llvm.org/D111409/new/
>
> https://reviews.llvm.org/D111409




Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111409/new/

https://reviews.llvm.org/D111409

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


Re: [Lldb-commits] [PATCH] D111409: proposed support for Java interface to Scripting Bridge

2021-10-08 Thread David Millar via lldb-commits
Am obviously brand new to your process and a bit of an old dog when it comes to 
learning new tricks.  Would you prefer I make a new submission with the 
-U99 diff?   Also, am more than willing to help with the Java tests if that 
would be useful.


From: Raphael Isemann via Phabricator 
Sent: Friday, October 8, 2021 10:46:50 AM
To: David Millar; anoro...@apple.com; fallk...@yahoo.com; kkle...@redhat.com; 
medismail.benn...@gmail.com; jo...@devlieghere.com; tedw...@quicinc.com; 
jmole...@apple.com; syaghm...@apple.com; jing...@apple.com; v...@apple.com; 
boris.ulasev...@gmail.com; lldb-commits@lists.llvm.org; h.imai@nitech.jp; 
bruce.mitche...@gmail.com; david.spick...@linaro.org; 
quic_soura...@quicinc.com; djordje.todoro...@syrmia.com; 
serhiy.re...@gmail.com; liburd1...@outlook.com
Cc: mgo...@gentoo.org
Subject: [PATCH] D111409: proposed support for Java interface to Scripting 
Bridge

teemperor added a comment.

In D111409#3051110 , @d-millar wrote:

> Apologies for the inclusion of that last file "patch" - that is the "git diff 
> -U999" result, should that be useful.

You can just upload that diff file and Phabricator will display it properly. 
There is no need to include the raw diff as part of the patch itself (it just 
makes this diff 100 times larger than it needs to be) :)

Anyway, I think this seems like a reasonable thing to have. We have to figure 
out though how we can properly set up some Java tests for this and it would be 
nice if we also find a bot that could actually run the tests for us.




Comment at: lldb/bindings/java/CMakeLists.txt:3
+ * IP: Apache License 2.0 with LLVM Exceptions
+ */
+add_custom_command(

I don't think CMake accepts this as a comment and I think we anyway don't put 
license headers in CMake scripts.



Comment at: lldb/source/API/CMakeLists.txt:84
   SBTrace.cpp
+  SBTraceOptions.cpp
   SBType.cpp

I think this is some conflict with one of the SBTrace patches.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111409/new/

https://reviews.llvm.org/D111409

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