comparison agent/src/os/linux/LinuxDebuggerLocal.c @ 23475:d06b64fc150f

8145099: Better error message when SA can't attach to a process Reviewed-by: jbachorik, stuefe
author sla
date Thu, 10 Dec 2015 16:09:36 +0100
parents f2512d89ad0c
children
comparison
equal deleted inserted replaced
23474:7c5babab479b 23475:d06b64fc150f
207 char buf[PATH_MAX]; 207 char buf[PATH_MAX];
208 snprintf((char *) &buf, PATH_MAX, "/proc/%d/exe", jpid); 208 snprintf((char *) &buf, PATH_MAX, "/proc/%d/exe", jpid);
209 verifyBitness(env, (char *) &buf); 209 verifyBitness(env, (char *) &buf);
210 CHECK_EXCEPTION; 210 CHECK_EXCEPTION;
211 211
212 char err_buf[200];
212 struct ps_prochandle* ph; 213 struct ps_prochandle* ph;
213 if ( (ph = Pgrab(jpid)) == NULL) { 214 if ( (ph = Pgrab(jpid, err_buf, sizeof(err_buf))) == NULL) {
214 THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process"); 215 char msg[230];
216 snprintf(msg, sizeof(msg), "Can't attach to the process: %s", err_buf);
217 THROW_NEW_DEBUGGER_EXCEPTION(msg);
215 } 218 }
216 (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph); 219 (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph);
217 fillThreadsAndLoadObjects(env, this_obj, ph); 220 fillThreadsAndLoadObjects(env, this_obj, ph);
218 } 221 }
219 222