Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
c372c58b
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c372c58b
编写于
12月 10, 2015
作者:
S
sla
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8145099: Better error message when SA can't attach to a process
Reviewed-by: jbachorik, stuefe
上级
2d191657
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
9 deletion
+16
-9
agent/src/os/linux/LinuxDebuggerLocal.c
agent/src/os/linux/LinuxDebuggerLocal.c
+5
-2
agent/src/os/linux/libproc.h
agent/src/os/linux/libproc.h
+1
-1
agent/src/os/linux/ps_proc.c
agent/src/os/linux/ps_proc.c
+10
-6
未找到文件。
agent/src/os/linux/LinuxDebuggerLocal.c
浏览文件 @
c372c58b
...
@@ -209,9 +209,12 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_at
...
@@ -209,9 +209,12 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_at
verifyBitness
(
env
,
(
char
*
)
&
buf
);
verifyBitness
(
env
,
(
char
*
)
&
buf
);
CHECK_EXCEPTION
;
CHECK_EXCEPTION
;
char
err_buf
[
200
];
struct
ps_prochandle
*
ph
;
struct
ps_prochandle
*
ph
;
if
(
(
ph
=
Pgrab
(
jpid
))
==
NULL
)
{
if
(
(
ph
=
Pgrab
(
jpid
,
err_buf
,
sizeof
(
err_buf
)))
==
NULL
)
{
THROW_NEW_DEBUGGER_EXCEPTION
(
"Can't attach to the process"
);
char
msg
[
230
];
snprintf
(
msg
,
sizeof
(
msg
),
"Can't attach to the process: %s"
,
err_buf
);
THROW_NEW_DEBUGGER_EXCEPTION
(
msg
);
}
}
(
*
env
)
->
SetLongField
(
env
,
this_obj
,
p_ps_prochandle_ID
,
(
jlong
)(
intptr_t
)
ph
);
(
*
env
)
->
SetLongField
(
env
,
this_obj
,
p_ps_prochandle_ID
,
(
jlong
)(
intptr_t
)
ph
);
fillThreadsAndLoadObjects
(
env
,
this_obj
,
ph
);
fillThreadsAndLoadObjects
(
env
,
this_obj
,
ph
);
...
...
agent/src/os/linux/libproc.h
浏览文件 @
c372c58b
...
@@ -82,7 +82,7 @@ typedef int bool;
...
@@ -82,7 +82,7 @@ typedef int bool;
struct
ps_prochandle
;
struct
ps_prochandle
;
// attach to a process
// attach to a process
struct
ps_prochandle
*
Pgrab
(
pid_t
pid
);
struct
ps_prochandle
*
Pgrab
(
pid_t
pid
,
char
*
err_buf
,
size_t
err_buf_len
);
// attach to a core dump
// attach to a core dump
struct
ps_prochandle
*
Pgrab_core
(
const
char
*
execfile
,
const
char
*
corefile
);
struct
ps_prochandle
*
Pgrab_core
(
const
char
*
execfile
,
const
char
*
corefile
);
...
...
agent/src/os/linux/ps_proc.c
浏览文件 @
c372c58b
...
@@ -215,9 +215,12 @@ static bool ptrace_waitpid(pid_t pid) {
...
@@ -215,9 +215,12 @@ static bool ptrace_waitpid(pid_t pid) {
}
}
// attach to a process/thread specified by "pid"
// attach to a process/thread specified by "pid"
static
bool
ptrace_attach
(
pid_t
pid
)
{
static
bool
ptrace_attach
(
pid_t
pid
,
char
*
err_buf
,
size_t
err_buf_len
)
{
if
(
ptrace
(
PTRACE_ATTACH
,
pid
,
NULL
,
NULL
)
<
0
)
{
if
(
ptrace
(
PTRACE_ATTACH
,
pid
,
NULL
,
NULL
)
<
0
)
{
print_debug
(
"ptrace(PTRACE_ATTACH, ..) failed for %d
\n
"
,
pid
);
char
buf
[
200
];
char
*
msg
=
strerror_r
(
errno
,
buf
,
sizeof
(
buf
));
snprintf
(
err_buf
,
err_buf_len
,
"ptrace(PTRACE_ATTACH, ..) failed for %d: %s"
,
pid
,
msg
);
print_debug
(
"%s
\n
"
,
err_buf
);
return
false
;
return
false
;
}
else
{
}
else
{
return
ptrace_waitpid
(
pid
);
return
ptrace_waitpid
(
pid
);
...
@@ -339,16 +342,17 @@ static ps_prochandle_ops process_ops = {
...
@@ -339,16 +342,17 @@ static ps_prochandle_ops process_ops = {
};
};
// attach to the process. One and only one exposed stuff
// attach to the process. One and only one exposed stuff
struct
ps_prochandle
*
Pgrab
(
pid_t
pid
)
{
struct
ps_prochandle
*
Pgrab
(
pid_t
pid
,
char
*
err_buf
,
size_t
err_buf_len
)
{
struct
ps_prochandle
*
ph
=
NULL
;
struct
ps_prochandle
*
ph
=
NULL
;
thread_info
*
thr
=
NULL
;
thread_info
*
thr
=
NULL
;
if
(
(
ph
=
(
struct
ps_prochandle
*
)
calloc
(
1
,
sizeof
(
struct
ps_prochandle
)))
==
NULL
)
{
if
(
(
ph
=
(
struct
ps_prochandle
*
)
calloc
(
1
,
sizeof
(
struct
ps_prochandle
)))
==
NULL
)
{
print_debug
(
"can't allocate memory for ps_prochandle
\n
"
);
snprintf
(
err_buf
,
err_buf_len
,
"can't allocate memory for ps_prochandle"
);
print_debug
(
"%s
\n
"
,
err_buf
);
return
NULL
;
return
NULL
;
}
}
if
(
ptrace_attach
(
pid
)
!=
true
)
{
if
(
ptrace_attach
(
pid
,
err_buf
,
err_buf_len
)
!=
true
)
{
free
(
ph
);
free
(
ph
);
return
NULL
;
return
NULL
;
}
}
...
@@ -371,7 +375,7 @@ struct ps_prochandle* Pgrab(pid_t pid) {
...
@@ -371,7 +375,7 @@ struct ps_prochandle* Pgrab(pid_t pid) {
thr
=
ph
->
threads
;
thr
=
ph
->
threads
;
while
(
thr
)
{
while
(
thr
)
{
// don't attach to the main thread again
// don't attach to the main thread again
if
(
ph
->
pid
!=
thr
->
lwp_id
&&
ptrace_attach
(
thr
->
lwp_id
)
!=
true
)
{
if
(
ph
->
pid
!=
thr
->
lwp_id
&&
ptrace_attach
(
thr
->
lwp_id
,
err_buf
,
err_buf_len
)
!=
true
)
{
// even if one attach fails, we get return NULL
// even if one attach fails, we get return NULL
Prelease
(
ph
);
Prelease
(
ph
);
return
NULL
;
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录