Comment the meaningless codes.
Add the logic of null check to a variable.
Resolve the unboxing case of Boolean object.
Resolve the issue to start a thread in the constructor.
Change-Id: I880016783307240fac0ed7d8cf1195125d4ba18b
Signed-off-by: seokgil.kang <seokgil.kang@samsung.com>
* @param um the unit mask
* @return whether the requested event is valid
*/
- public static Boolean checkEvent(int ctr, int event, int um) {
+ // seokgil.kang modified at 20140326
+ // occurred NPE(NullPointException) for Boolean object unboxing
+ // return value
+ // 1 : true
+ // 0 : false
+ // -1 : error
+// public static Boolean checkEvent(int ctr, int event, int um) {
+ public static int checkEvent(int ctr, int event, int um) {
int[] validResult = new int[1];
try {
IRunnableWithProgress opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().checkEvents(ctr, event, um, validResult);
e.printStackTrace();
} catch (OpxmlException e) {
OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$
- return (Boolean)null;
+// return (Boolean)null;
+ return -1;
}
- return (validResult[0] == CheckEventsProcessor.EVENT_OK);
+// return (validResult[0] == CheckEventsProcessor.EVENT_OK);
+ if (validResult[0] == CheckEventsProcessor.EVENT_OK) {
+ return 1;
+ } else {
+ return 0;
+ }
}
exeFile = CDebugUtils.verifyProgramPath(config);
DebugPlugin.newProcess(launch, oprofileProc, exeFile
.toFile().getName());
- BufferedReader br = new BufferedReader(new InputStreamReader(
- oprofileProc.getInputStream(), Charset.forName("UTF-8")));
- if (null != br) {
- while (null != br.readLine()) {
- ;
- }
- br.close();
- }
+ // seokgil.kang modified at 20140328
+ // meaningful process ??
+// BufferedReader br = new BufferedReader(new InputStreamReader(
+// oprofileProc.getInputStream(), Charset.forName("UTF-8")));
+// if (null != br) {
+// while (null != br.readLine()) {
+// ;
+// }
+// br.close();
+// }
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ }
+ // seokgil.kang modified at 20140328
+// catch (IOException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
}
* @param mask unit mask value
* @return true or false, depending if the event config is valid
*/
+ // seokgil.kang modified at 20140328
public boolean checkEvent(int counter, int event, int mask) {
CheckEventEntry e = new CheckEventEntry(counter, event, mask);
+// Boolean result = null;
+//
+// result = validEventCache.get(e);
+//
+// if (result == null) {
+// //not in the map, get its value and add it in
+// result = Oprofile.checkEvent(counter, event, mask);
+//
+// //possible to be null if there is no opxmlProvider
+// if (result != null) {
+// validEventCache.put(e, result);
+// }
+// }
+//
+// return (result == null ? false : result);
+
Boolean result = null;
+ int res = 0;
result = validEventCache.get(e);
if (result == null) {
//not in the map, get its value and add it in
- result = Oprofile.checkEvent(counter, event, mask);
+ res = Oprofile.checkEvent(counter, event, mask);
- //possible to be null if there is no opxmlProvider
- if (result != null) {
+ //possible to be -1 if there is no opxmlProvider
+ if (res != -1) {
validEventCache.put(e, result);
}
}
- return (result == null ? false : result);
+ if (result == null) {
+ if (res == -1) {
+ return false;
+ } else if (res == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return result;
+ }
}
-
}
String device_id = LaunchUtils.getDeviceId(device);
IPath programPath = AbstractCLaunchDelegate.getProgramPath(config);
String projectName = AbstractCLaunchDelegate.getProjectName(config);
- IPath binPath = bin.getResource().getProjectRelativePath();
- if (programPath != null && programPath.equals(binPath)) {
- if (projectName != null && projectName.equals(bin.getCProject().getProject().getName())
- && config_device_id.equals(device_id))
- {
- candidateConfigs.add(config);
+ if (bin != null) {
+ IPath binPath = bin.getResource().getProjectRelativePath();
+ if (programPath != null && programPath.equals(binPath)) {
+ if (projectName != null && projectName.equals(bin.getCProject().getProject().getName())
+ && config_device_id.equals(device_id))
+ {
+ candidateConfigs.add(config);
+ }
}
}
}
return processFactory
.newProcess(launch, process, label, attributes);
}
- return new ValgrindRuntimeProcess(launch, process, label, attributes);
+ // seokgil.kang modified at 20140328
+// return new ValgrindRuntimeProcess(launch, process, label, attributes);
+ ValgrindRuntimeProcess valgrindRuntimeProc = new ValgrindRuntimeProcess(launch, process, label, attributes);
+ valgrindRuntimeProc.startProcessMonitorThread();
+ return valgrindRuntimeProc;
}
/**
fStreamsProxy = createStreamsProxy();
fMonitor = new ProcessMonitorThread(this);
- fMonitor.start();
+ // seokgil.kang modified at 20140328
+// fMonitor.start();
launch.addProcess(this);
fireCreationEvent();
}
DebugCoreMessages.RuntimeProcess_Exit_value_not_available_until_process_terminates__1,
null));
}
+
+ // seokgil.kang modified at 20140328
+ /**
+ * Start ProcessMonitorThread
+ */
+ public void startProcessMonitorThread() {
+ if (fMonitor != null)
+ fMonitor.start();
+ }
/**
* Monitors a system process, waiting for it to terminate, and then notifies