博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OpenJDK9 Hotspot Mac OSX 编译和调试
阅读量:7050 次
发布时间:2019-06-28

本文共 1454 字,大约阅读时间需要 4 分钟。

Intellij CLion CPU 占用率太高,还出各种奇怪问题,转投 Xcode 调试 hotspot

安装 hg

# brew install hg

下载 open jdk 9 源代码

# hg clone http://hg.openjdk.java.net/jdk9/dev

漫长等待,中间无数次中断

安装 freetype

# brew install freetype

安装 libffi(可选)

如果要使用 zero 解释器,需要安装 libffi

# brew install libffi

configure

# bash configure --with-debug-level=slowdebug \--with-freetype=/usr/local/opt/freetype \--disable-warnings-as-errors \--with-jvm-features=zero \--with-jvm-variants=zero \--with-libffi=/usr/local/opt/libffi \--with-libffi-include=/usr/local/Cellar/libffi/3.0.13/lib/libffi-3.0.13/include

--with-debug-level

设置调试级别,设成 slow debug 可以提供更多的调试信息

--with-free-type

设置 free type 路径

--disable-warnings-as-errors

忽略警告

--with-jvm-features

设置使用 c++ 实现的 zero 解释器,比基于模版的解释器更容易调试(如果汇编功力不够的话)

--with-jvm-variants

配合 --with-jvm-features 使用

--with-libffi

配合 --with-jvm-features 使用

--with-libffi-include

设置 libffi include 文件夹路径

make

# make

构建成功后:

jdk -> build/macosx-x86_64-normal-server-slowdebug/jdk
hotspot -> build/macosx-x86_64-normal-server-slowdebug/hotspot

Xcode 调试

新建 command line 工程

新建一个 command line(命令行工具)工程,新建后删除 XCode 自动生成的代码

编辑 hotspot scheme

首先去掉 IDE build 配置,因为我们无法(也不需要)在IDE中构建 hotspot,其次将运行目标修改为: <jdk源代码目录>/build/macosx-x86_64-normal-server-slowdebug/jdk/bin/java(在编译源代码阶段已经生成)

添加 hotspot src 到工程

右击 hotspot 工程,选择 "add files to project" 添加 <jdk源代码目录>/hotspot/src 到工程中

在 jni.cpp 的 JNI_CreateJavaVM 方法中设置断点, goooooo

如果出现 sigsegv 信号中断,可以在 lldb 中设置

(lldb) process handle SIGSEGV --stop=false

上图

图片描述

转载地址:http://mccol.baihongyu.com/

你可能感兴趣的文章
Android MVVM开发——DataBinding基础
查看>>
php中file_get_content 和curl以及fopen
查看>>
基于 Pusher 驱动的 Laravel 事件广播(上)
查看>>
fuel部署openstack 打开fuel的UI界面出现白屏的情况
查看>>
PhpStrom安装Xdebug调试工具
查看>>
Spark Streaming源码解读之数据清理 内幕
查看>>
项目打包流程
查看>>
vue-cli项目动态引用图片链接问题
查看>>
规格模式取代sql查询代码
查看>>
iOS 如何去掉Tabbar上的黑线
查看>>
eclipse远程调试(windows)
查看>>
FDStatusBarNotifierView
查看>>
OpenStack云平台的网络模式及其工作机制
查看>>
PHP-FIG 定义的 PSR-3 日志接口规范
查看>>
【Qt笔记】使用拖放
查看>>
接口测试常用工具
查看>>
MyISAM和InnoDB的索引实现
查看>>
这样的一个asp.net免费购物系统的发展空间
查看>>
2018年最值得关注的30个Vue开源项目
查看>>
Java程序员,最常用的20%技术有哪些
查看>>