We are porting OpenJDK to RISC-V. We're at the point that the interpreter builds. We need to debug it, using GDB. However, we haven't been able to find a working GDB that works with RISC-V QEMU. Any help would be much appreciated.
It depends on what you mean by "GDB that works with QEMU". There's three use cases here
Running system-mode QEMU, trying to debug a machine-mode or supervisor-mode program (like the Linux kernel, for example). For this, you should be able to use the upstream RISC-V GDB port attached to QEMU's built-in GDB stup to debug like normal.
Running user-mode QEMU, trying to debug a user-mode program. I've never done this before, but I think you can still use QEMU's built-in GDB stub and connect with the upstream GDB.
Running system-mode QEMU, trying to debug a user-mode program (like OpenJDK, for example). In this case QEMU doesn't actually factor in to the equation, as you're really just looking for a standard Linux GDB port. Both our Linux and GDB ports are currently buggy when it comes to native debugging, but you should be able to take the latest upstream versions of both and at least get some work done. There's lots of issues with drivers in our upstream Linux port, but if you're just using QEMU's virt machine then you should be good to go.
I'm not actually sure StackOverflow is the best place to ask this question, as the answer will be obsolete pretty much as soon as it's been asked.
Related
A few of you might know Spigot (it's Minecraft server software). I'm trying to run their BuildTools.jar to update the current build, but I'm getting some weird git errors.
Info on BuildTools.jar
System: Windows 10. Worth noting I also have a few Google wifi things connected. My laptop is on the base wifi though and switching networks also gives the same errors.
Errors:
Exception in thread "main" org.eclipse.jgit.api.errors.TransportException: https://hub.spigotmc.org/stash/scm/spigot/bukkit.git: 504 Gateway Time-out when running command java -jar BuildTools.jar
fetch-pack: unexpected disconnect while reading sideband packet when running clone manually in PowerShell: git clone https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
I have tried:
Running both clone and java jar commands in a mix of PowerShell, git bash, and Linux subsystem for Windows
git config --global http.postBuffer 524288000"
Opening TCP 9418 on my router
Reinstalling Java and Git
Tried cloning on a different Windows computer where I use git often, same errors
Google says:
Clone with SSH instead (as far as I know I can't do this without the Spigot admins adding support for it on the repo)
What can I try next?
Works for me without any issues on the first try (and very fast!):
Did you make sure you downloaded the latest version of all tools you use? Specially for java it can quickly happen to use an outdated version. From their instructions at least Java 8 is required. I am currently running Java 10 (OpenJDK).
Their docs also state:
Please be aware that it is required that you have BuildTools #35 or later, older versions will not work
So you should make sure you also have the appropriate version of the tools (which I expect since 35 seems to be really old).
Usually 5XX errors indicate server side errors. Maybe they had some config or network issues on their end. Therefore it might work if you'll try it again after waiting a little while.
Maybe just some network node on the way to their servers broke. Apart from waiting and to try again you could try to setup a VPN to route the traffic throgh to avoid this failure (or turn it off in case you're using some!).
Maybe it's also worth to check your firewall (or proxy) settings.
PS: I was using git bash also on a Win 10 machine.
I work on a Macbook and I would like to close some running applications such as Remote Desktops through using Java.
I'm quite new to programming in Java and other than Google and StackOverflow I'm not sure where to go. I already looked for a solution on Google but all I can find are instruction on how to close Java on Mac OS, not actually how you close a running application through Java code.
So I am looking for some pointers on what Java commands I should use to close a running application in Mac OS. Thank you very much :)
While programming in Java, you only have access to do things inside the JVM. But your code inside the JVM wouldn't usually have permissions to affect other processes running on the operating system.
You can definitely call an external command with something like this:
Process process = Runtime.getRuntime().exec("kill 12345");
That would run the kill command on process id 12345. This would work, assuming you have the right permissions.
You can get more information on the exec command in the docs: https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String)
I assume the question is strongly related to this one but it is closed and the solution does not seem clear to me.
I am trying to use VisualVM to profile a console Scala application of mine. I do this by starting VisualVM, starting my Scala application, opening its node in VisualVM, going to the "Profiler" tab and clicking "CPU". The button goes grey for some time (while status never changes to anything from "profiling inactive"), then back active but no profiling data appears shown.
The application does some file reading, data processing (which takes about a minute), stdout data output and exits. I've also tried adding Thread.sleep(60000) to the beginning and to the end of the program to ensure enough time for VisualVM to capture it and do the job, nothing changed though.
Unlike to the related question I've linked to I don't launch my app from Eclipse or anything else - I use the following command line to launch it:
java -classpath myapp.jar:lib/* MyApp.Main
all the libraries (including scala-library.jar) are put in lib/. The app works as expected.
Updates:
I have tried YourKit Java Profiler 11.0.2 and it fails with AttachNotSupportedException.
I've managed with YourKit by attaching the agent manually.
It seems worth stressing that I neither run the application from an IDE (or a build tool) nor have I modified any JVM options but classpath. As far as I understand this problem appears to depend on a JVM version and user/permission issues and. The objective is to figure out the actual mechanism of the problem and the way to configure all the things to work.
Versions of the software used:
YourKit Java Profiler 11.0.2
VisualVM 1.3.4
SBT 0.12.3 (to build but not to run (I've tried both actually))
Scala 2.9.2
Oracle Java 1.7.0_04-b20
XUbuntu Linux 12.04 32-bit i386
Linux kernel 3.2.0-24-generic-pae
I have used VisualVM to profile a Scala application two days ago, so I believe it should work. Here are my suggestions:
Take out YourKit out of the equation and run things without it for a starter
Take out scala out of the equation, try profiling a Java hello world that does while (true) { Thread.sleep(10000); }
Get that to work then put back Scala, then put back YourKit.
Edit: based on your input, I suggest to explicitly set the remote JMX connection. You can start java with the following options:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=20000
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Then in VisualVM, add a JMX connection to localhost:20000.
I'm developing a multithreaded webserver applet and have been dealing with system.out.println's for the past week or so as my "debugging" tool. As far as I understand it, the .jar I build is split by a builder and put into .html files and then spit out when I access the web server.
I am wondering if there is some way that I would be able to attach a debugger (plugin?) to Java's virtual machine that would allow me to step through the code as I operate the webserver- there are some critical exceptions that are very frustrating to track down. I believe they're timing issues related to the multithreading which makes them even more unreliable when attempting to locate, and may mean that the debugger won't process appropriately. I don't think it matters, but the IDE I'm building in is Netbeans.
I've taken over a previous developer's hastily-not-quite-finished project and am in well over my head. =/ Thanks in advance for any possible solutions, I appreciate it.
Sure you can.
You need to start the web server JVM with suitable arguments allowing it to be debugged remotely. You can see at http://download.oracle.com/javase/1.3/docs/tooldocs/win32/jdb.html how to do it. jdb is available in the JDK along with javac. You then launch your IDE debugger to connect to your JVM and tell it where the source for your classes is located. Remember to compile with debug information.
As you have it inside Netbeans already then consider just launching it in debug mode as then all the extra work described above will be done automatically for you.
I have a java process running on a Linux box, but it cannot be started/re-started in debug mode. I read about the jsadebugd command and started the daemon, but I want to connect to it from an IDE(possibly Eclipse) debugger or maybe YourKit or jconsole. How can I do this? The remote JVM is 1.6+.
I assume since you mentioned Yourkit and other tool that what you really want to do is look at object state inside your applications. There are a couple of options, though I don't think it gets you the ability to set break-points like Eclipse or another debugger would (though I'd be intersted in hearing what restricts you from starting the process in debug mode - technical? process?)
have you tried connecting with: VisualVM? I don't believe you need to start in debug mode, and it will give you the ability to navigate the object graph, and inspect objects. You can even use it to take heapdumps and do some ad-hoc analysis through them using OQL queries.
If you're running on JDK6+ - have you tried instrumenting with btrace? Some notes from the sailfin team sounded promising, and like DTrace in Solaris, this seem like it would be useful in a variety of situations.
I am not sure if I understand your restrictions correctly but you can start JVM with debugging server (serving JDWP) enabled. See for example "Sun VM Invocation Options" in http://java.sun.com/j2se/1.4.2/docs/guide/jpda/conninv.html
Then you can connect your Eclipse debugger to running JVM. See "Remote debugging" section here http://www.ibm.com/developerworks/library/os-ecbug/
I'm not sure that this is exposed by Eclipse, but here's how to do it with jdb:
http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/tooldescr.html#gbmog