On 21/08/17 13:30, Erik Joelsson wrote:
For each generated object file, there is a corresponding .cmdline file which contains the full compile command line. That file can be parsed to extract the relevant flags that were used, and is probably easier to work with than parsing a debug build log.
I noticed those. That's how I got started.

I've created a small makefile that extracts the relevant configuration (this is inspired by my former work on creating an IntelliJ template project) - webrev available here

http://cr.openjdk.java.net/~mcimadamore/hotspot_flags/

Probably we'd want to remove references to 'atom' in the targets and script - but I think something like this could be very useful for integration of hotspot with IDE (I think Netbeans and Eclipse CDT need something very similar to get started).

Maurizio


/Erik


On 2017-08-11 15:37, Maurizio Cimadamore wrote:
Hi,
over the last few days I've been looking at integrating hotspot with the Atom editor [1]. I managed to do it successfully and I can now debug hotspot from Atom and even enable code completion (requires clang plugin [2]). Regarding code completion, to make it work, you have to come up with a file named ".clang_complete", which contains all the options that should be passed to the clang compiler. In my case, such options are

-I/w/valhalla/hotspot/src/os/linux/vm
-I/w/valhalla/hotspot/src/share/vm
-I/w/valhalla/hotspot/src/share/vm/precompiled
-I/w/valhalla/hotspot/src/cpu/x86/vm
-I/w/valhalla/hotspot/src/os_cpu/linux_x86/vm
-I/w/valhalla/hotspot/src/os/posix/vm/
-I/w/valhalla/hotspot/test/native/logging
-I/w/valhalla/hotspot/test/native
-I/w/valhalla/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/gensrc/
-I/w/valhalla/build/linux-x86_64-normal-server-slowdebug/jdk/include/
-std=gnu++98
-D_GNU_SOURCE
-D_REENTRANT
-fcheck-new
-D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
-DSUPPORTS_CLOCK_MONOTONIC
-DLINUX
-pipe
-fPIC
-fno-rtti
-fno-exceptions
-fvisibility=hidden
-fno-strict-aliasing
-fno-omit-frame-pointer
-DVM_LITTLE_ENDIAN
-D_LP64=1
-Wpointer-arith
-Wsign-compare
-Wunused-function
-Wunused-value
-Woverloaded-virtual
-Wno-format-zero-length
-Wtype-limits
-Wuninitialized
-Wreturn-type
-Wundef
-Wformat=2
-DASSERT
-D_NMT_NOINLINE_
-DTARGET_ARCH_x86
-DINCLUDE_SUFFIX_OS=_linux
-DINCLUDE_SUFFIX_CPU=_x86
-DINCLUDE_SUFFIX_COMPILER=_gcc
-DTARGET_COMPILER_gcc
-DAMD64 -DHOTSPOT_LIB_ARCH='"amd64"'
-DCOMPILER1
-DCOMPILER2
-DINCLUDE_AOT

I mostly obtained them through a combination of trial and error and looking at the various build log, to try and figure out how gcc was called on my env. My question is - is there a way to obtain such flags in a more systematic way using the build system? I presume that hotspot IDE integration (not just for Atom) depends on something like that - as otherwise the IDE doesn't know where to find sources, and which flags/define should be used to process hpp files.

In other words, is there a way to write a script to generate the above automatically, and in a robust way?

[1] - https://atom.io/

Cheers
Maurizio




Reply via email to