On Thu, 4 Mar 2021 01:09:40 GMT, Yasumasa Suenaga <ysuen...@openjdk.org> wrote:
>>> I think we should remove `main()` from CLHSDB/HSDB to be honest because >>> they are called from SALauncher, and we cannot call them directly because >>> they are not exported in module-info. >> >> Yes, I'm starting to come to the same conclusion. The only code that >> constructs a `CLHSDB` object, and therefore triggers the potential call to >> `doUsage()`, is `CLHSDB.main()`, and it is only called from `SALauncher` >> when using `jhsdb clhsdb`. We could get rid of `main()` and have some other >> entrypoint that is passed the values of all the possible options, rather >> than having to parse them in CLHSDB.java. >> >> There is one test invokes java with the `CLHSDB` class. See SABase.java. >> It's part of ciReplay testing. I think it would be easily modified to just >> run `jhsdb clhsdb` > >> Yes, I'm starting to come to the same conclusion. The only code that >> constructs a `CLHSDB` object, and therefore triggers the potential call to >> `doUsage()`, is `CLHSDB.main()`, and it is only called from `SALauncher` >> when using `jhsdb clhsdb`. We could get rid of `main()` and have some other >> entrypoint that is passed the values of all the possible options, rather >> than having to parse them in CLHSDB.java. >> >> There is one test invokes java with the `CLHSDB` class. See SABase.java. >> It's part of ciReplay testing. I think it would be easily modified to just >> run `jhsdb clhsdb` > > I think `debugd` and `jsnap` are also remove `main()` if they have because > they do not provide commands like `jstack`. > I will file it to JBS, and will fix them later. BTW, referring back to the change to have attach handle pids and debug servernames, and the concern about a host having a numeric name, we already have code that assumes we don't have to deal with this in Tools.java. I just stumbled across this: try { pid = Integer.parseInt(args[0]); debugeeType = DEBUGEE_PID; } catch (NumberFormatException e) { // try remote server remoteServer = args[0]; debugeeType = DEBUGEE_REMOTE; } ------------- PR: https://git.openjdk.java.net/jdk/pull/2773