PageRenderTime 56ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/projects/netbeans-7.3/cnd.dwarfdiscovery/test/unit/src/org/netbeans/modules/cnd/dwarfdiscovery/provider/DwarfSourceReaderTest.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 857 lines | 774 code | 22 blank | 61 comment | 35 complexity | e30df24b2d69b94077f930564fdcf858 MD5 | raw file
  1. /*
  2. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  3. *
  4. * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
  5. *
  6. * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  7. * Other names may be trademarks of their respective owners.
  8. *
  9. * The contents of this file are subject to the terms of either the GNU
  10. * General Public License Version 2 only ("GPL") or the Common
  11. * Development and Distribution License("CDDL") (collectively, the
  12. * "License"). You may not use this file except in compliance with the
  13. * License. You can obtain a copy of the License at
  14. * http://www.netbeans.org/cddl-gplv2.html
  15. * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  16. * specific language governing permissions and limitations under the
  17. * License. When distributing the software, include this License Header
  18. * Notice in each file and include the License file at
  19. * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
  20. * particular file as subject to the "Classpath" exception as provided
  21. * by Oracle in the GPL Version 2 section of the License file that
  22. * accompanied this code. If applicable, add the following below the
  23. * License Header, with the fields enclosed by brackets [] replaced by
  24. * your own identifying information:
  25. * "Portions Copyrighted [year] [name of copyright owner]"
  26. *
  27. * If you wish your version of this file to be governed by only the CDDL
  28. * or only the GPL Version 2, indicate your decision by adding
  29. * "[Contributor] elects to include this software in this distribution
  30. * under the [CDDL or GPL Version 2] license." If you do not indicate a
  31. * single choice of license, a recipient has the option to distribute
  32. * your version of this file under either the CDDL, the GPL Version 2 or
  33. * to extend the choice of license to its licensees as provided above.
  34. * However, if you add GPL Version 2 code and therefore, elected the GPL
  35. * Version 2 license, then the option applies only if the new code is
  36. * made subject to such option by the copyright holder.
  37. *
  38. * Contributor(s):
  39. *
  40. * Portions Copyrighted 2007 Sun Microsystems, Inc.
  41. */
  42. package org.netbeans.modules.cnd.dwarfdiscovery.provider;
  43. import java.io.File;
  44. import java.io.FileNotFoundException;
  45. import java.io.IOException;
  46. import java.util.ArrayList;
  47. import java.util.HashMap;
  48. import java.util.List;
  49. import java.util.Map;
  50. import java.util.TreeMap;
  51. import java.util.logging.Level;
  52. import java.util.logging.Logger;
  53. import org.netbeans.api.project.Project;
  54. import org.netbeans.junit.NbTestCase;
  55. import org.netbeans.modules.cnd.api.toolchain.CompilerFlavor;
  56. import org.netbeans.modules.cnd.api.toolchain.PlatformTypes;
  57. import org.netbeans.modules.cnd.discovery.api.ItemProperties;
  58. import org.netbeans.modules.cnd.discovery.api.ProjectProxy;
  59. import org.netbeans.modules.cnd.dwarfdiscovery.provider.BaseDwarfProvider.GrepEntry;
  60. import org.netbeans.modules.cnd.dwarfdump.CompilationUnitInterface;
  61. import org.netbeans.modules.cnd.dwarfdump.CompileLineService;
  62. import org.netbeans.modules.cnd.dwarfdump.CompileLineService.SourceFile;
  63. import org.netbeans.modules.cnd.dwarfdump.Dwarf;
  64. import org.netbeans.modules.cnd.dwarfdump.Dwarf.CompilationUnitIterator;
  65. import org.netbeans.modules.cnd.dwarfdump.exception.WrongFileFormatException;
  66. import org.openide.util.Exceptions;
  67. import org.openide.util.Utilities;
  68. /**
  69. *
  70. * @author Alexander Simon
  71. */
  72. public class DwarfSourceReaderTest extends NbTestCase {
  73. public DwarfSourceReaderTest() {
  74. super("DwarfSourceReaderTest");
  75. Logger.getLogger("cnd.logger").setLevel(Level.SEVERE);
  76. }
  77. @Override
  78. protected int timeOut() {
  79. return 500000;
  80. }
  81. public void testDllReader(){
  82. File dataDir = getDataDir();
  83. String objFileName = dataDir.getAbsolutePath()+"/org/netbeans/modules/cnd/dwarfdiscovery/provider/echo";
  84. Dwarf dump = null;
  85. try {
  86. dump = new Dwarf(objFileName);
  87. for(String dll : dump.readPubNames().getDlls()) {
  88. assertEquals(dll, "libc.so.1"); // NOI18N
  89. }
  90. } catch (FileNotFoundException ex) {
  91. Exceptions.printStackTrace(ex);
  92. } catch (WrongFileFormatException ex) {
  93. Exceptions.printStackTrace(ex);
  94. } catch (IOException ex) {
  95. Exceptions.printStackTrace(ex);
  96. } finally {
  97. if (dump != null) {
  98. dump.dispose();
  99. }
  100. }
  101. }
  102. public void testSunStudioCompiler(){
  103. TreeMap<String, String> golden = new TreeMap<String, String>();
  104. golden.put("TEXT_DOMAIN", "\"SUNW_OST_OSCMD\"");
  105. golden.put("_TS_ERRNO", "null");
  106. golden.put("_iBCS2", "null");
  107. TreeMap<String, String> ignore = new TreeMap<String, String>();
  108. List<String> system = new ArrayList<String>();
  109. Map<String,GrepEntry> grepBase = new HashMap<String, GrepEntry>();
  110. DwarfSource source = getDwarfSource("/org/netbeans/modules/cnd/dwarfdiscovery/provider/echo", system, ignore, grepBase, false, null);
  111. assertNotNull(source);
  112. TreeMap<String, String> map = new TreeMap<String, String>(source.getUserMacros());
  113. assertTrue(compareMap(map, golden));
  114. assertTrue(source.getUserInludePaths().size()==1);
  115. assertEquals(source.getUserInludePaths().get(0), "/export1/sside/pomona/java_cp/wsb131/proto/root_i386/usr/include");
  116. printInclidePaths(source);
  117. List<SourceFile> list = CompileLineService.getSourceFileProperties(getDataDir().getAbsolutePath()+"/org/netbeans/modules/cnd/dwarfdiscovery/provider/echo");
  118. assertEquals(1, list.size());
  119. SourceFile sf = list.get(0);
  120. assertEquals(sf.getCompileDir(), "/export1/sside/pomona/java_cp/wsb131/usr/src/cmd/echo");
  121. assertEquals(sf.getSource(), "echo.c");
  122. // /export/opt/sunstudio/12ml/SUNWspro/prod/bin/cc -O -xspace -Xa -xildoff -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT -erroff=E_STATEMENT_NOT_REACHED -xc99=%none -W0,-xglobalstatic -v -D_iBCS2 -DTEXT_DOMAIN='"SUNW_OST_OSCMD"' -D_TS_ERRNO -I/export1/sside/pomona/java_cp/wsb131/proto/root_i386/usr/include -Bdirect -M/export1/sside/pomona/java_cp/wsb131/usr/src/common/mapfiles/common/map.noexstk -M/export1/sside/pomona/java_cp/wsb131/usr/src/common/mapfiles/i386/map.pagealign -M/export1/sside/pomona/java_cp/wsb131/usr/src/common/mapfiles/i386/map.noexdata -L/export1/sside/pomona/java_cp/wsb131/proto/root_i386/lib -L/export1/sside/pomona/java_cp/wsb131/proto/root_i386/usr/lib -c echo.c
  123. //System.err.println(sf.getCompileLine());
  124. map = new TreeMap<String, String>(sf.getUserMacros());
  125. assertTrue(compareMap(map, golden));
  126. assertEquals(sf.getUserPaths().get(0), "/export1/sside/pomona/java_cp/wsb131/proto/root_i386/usr/include");
  127. list = CompileLineService.getSourceFolderProperties(getDataDir().getAbsolutePath());
  128. //assertEquals(8, list.size());
  129. int i = 0;
  130. for(SourceFile file : list){
  131. if (!file.getCompileLine().isEmpty()) {
  132. i++;
  133. }
  134. }
  135. assertEquals(2, i);
  136. }
  137. public void testLeopard(){
  138. TreeMap<String, String> golden = new TreeMap<String, String>();
  139. golden.put("OBJC_NEW_PROPERTIES", "1");
  140. TreeMap<String, String> ignore = new TreeMap<String, String>();
  141. ignore.put("__APPLE_CC__", "5465");
  142. ignore.put("__APPLE__", "1");
  143. ignore.put("__CHAR_BIT__", "8");
  144. ignore.put("__CONSTANT_CFSTRINGS__", "1");
  145. ignore.put("__DBL_DENORM_MIN__", "4.9406564584124654e-324");
  146. ignore.put("__DBL_DIG__", "15");
  147. ignore.put("__DBL_EPSILON__", "2.2204460492503131e-16");
  148. ignore.put("__DBL_HAS_INFINITY__", "1");
  149. ignore.put("__DBL_HAS_QUIET_NAN__", "1");
  150. ignore.put("__DBL_MANT_DIG__", "53");
  151. ignore.put("__DBL_MAX_10_EXP__", "308");
  152. ignore.put("__DBL_MAX_EXP__", "1024");
  153. ignore.put("__DBL_MAX__", "1.7976931348623157e+308");
  154. ignore.put("__DBL_MIN_10_EXP__", "(-307)");
  155. ignore.put("__DBL_MIN_EXP__", "(-1021)");
  156. ignore.put("__DBL_MIN__", "2.2250738585072014e-308");
  157. ignore.put("__DECIMAL_DIG__", "21");
  158. ignore.put("__DEPRECATED", "1");
  159. ignore.put("__DYNAMIC__", "1");
  160. ignore.put("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", "1050");
  161. ignore.put("__EXCEPTIONS", "1");
  162. ignore.put("__FINITE_MATH_ONLY__", "0");
  163. ignore.put("__FLT_DENORM_MIN__", "1.40129846e-45F");
  164. ignore.put("__FLT_DIG__", "6");
  165. ignore.put("__FLT_EPSILON__", "1.19209290e-7F");
  166. ignore.put("__FLT_EVAL_METHOD__", "0");
  167. ignore.put("__FLT_HAS_INFINITY__", "1");
  168. ignore.put("__FLT_HAS_QUIET_NAN__", "1");
  169. ignore.put("__FLT_MANT_DIG__", "24");
  170. ignore.put("__FLT_MAX_10_EXP__", "38");
  171. ignore.put("__FLT_MAX_EXP__", "128");
  172. ignore.put("__FLT_MAX__", "3.40282347e+38F");
  173. ignore.put("__FLT_MIN_10_EXP__", "(-37)");
  174. ignore.put("__FLT_MIN_EXP__", "(-125)");
  175. ignore.put("__FLT_MIN__", "1.17549435e-38F");
  176. ignore.put("__FLT_RADIX__", "2");
  177. ignore.put("__GNUC_MINOR__", "0");
  178. ignore.put("__GNUC_PATCHLEVEL__", "1");
  179. ignore.put("__GNUC__", "4");
  180. ignore.put("__GNUG__", "4");
  181. ignore.put("__GXX_ABI_VERSION", "1002");
  182. ignore.put("__GXX_WEAK__", "1");
  183. ignore.put("__INTMAX_MAX__", "9223372036854775807LL");
  184. ignore.put("__INTMAX_TYPE__", "long long int");
  185. ignore.put("__INT_MAX__", "2147483647");
  186. ignore.put("__LDBL_DENORM_MIN__", "3.64519953188247460253e-4951L");
  187. ignore.put("__LDBL_DIG__", "18");
  188. ignore.put("__LDBL_EPSILON__", "1.08420217248550443401e-19L");
  189. ignore.put("__LDBL_HAS_INFINITY__", "1");
  190. ignore.put("__LDBL_HAS_QUIET_NAN__", "1");
  191. ignore.put("__LDBL_MANT_DIG__", "64");
  192. ignore.put("__LDBL_MAX_10_EXP__", "4932");
  193. ignore.put("__LDBL_MAX_EXP__", "16384");
  194. ignore.put("__LDBL_MAX__", "1.18973149535723176502e+4932L");
  195. ignore.put("__LDBL_MIN_10_EXP__", "(-4931)");
  196. ignore.put("__LDBL_MIN_EXP__", "(-16381)");
  197. ignore.put("__LDBL_MIN__", "3.36210314311209350626e-4932L");
  198. ignore.put("__LITTLE_ENDIAN__", "1");
  199. ignore.put("__LONG_LONG_MAX__", "9223372036854775807LL");
  200. ignore.put("__LONG_MAX__", "2147483647L");
  201. ignore.put("__MACH__", "1");
  202. ignore.put("__MMX__", "1");
  203. ignore.put("__NO_INLINE__", "1");
  204. ignore.put("__PIC__", "1");
  205. ignore.put("__PTRDIFF_TYPE__", "int");
  206. ignore.put("__REGISTER_PREFIX__", "");
  207. ignore.put("__SCHAR_MAX__", "127");
  208. ignore.put("__SHRT_MAX__", "32767");
  209. ignore.put("__SIZE_TYPE__", "long unsigned int");
  210. ignore.put("__SSE2_MATH__", "1");
  211. ignore.put("__SSE2__", "1");
  212. ignore.put("__SSE_MATH__", "1");
  213. ignore.put("__SSE__", "1");
  214. ignore.put("__STDC_HOSTED__", "1");
  215. ignore.put("__UINTMAX_TYPE__", "long long unsigned int");
  216. ignore.put("__USER_LABEL_PREFIX__", "_");
  217. ignore.put("__VERSION__", "\"4.0.1 (Apple Inc. build 5465)\"");
  218. ignore.put("__WCHAR_MAX__", "2147483647");
  219. ignore.put("__WCHAR_TYPE__", "int");
  220. ignore.put("__WINT_TYPE__", "int");
  221. ignore.put("__cplusplus", "1");
  222. ignore.put("__i386", "1");
  223. ignore.put("__i386__", "1");
  224. ignore.put("__private_extern__", "extern");
  225. ignore.put("__strong", "");
  226. ignore.put("__weak", "");
  227. ignore.put("i386", "1");
  228. List<String> system = new ArrayList<String>();
  229. String prefix = "";
  230. system.add(prefix+"/usr/include");
  231. system.add(prefix+"/usr/include/c++/4.0.0");
  232. system.add(prefix+"/usr/include/c++/4.0.0/i686-apple-darwin9/bits");
  233. system.add(prefix+"/usr/include/libkern");
  234. system.add(prefix+"/usr/include/libkern/i386");
  235. system.add(prefix+"/usr/include/mach/i386");
  236. system.add(prefix+"/usr/lib/gcc/i686-apple-darwin9/4.0.1/include");
  237. Map<String,GrepEntry> grepBase = new HashMap<String, GrepEntry>();
  238. GrepEntry entry = new GrepEntry();
  239. grepBase.put(prefix+"/usr/include", entry);
  240. entry.includes.add("/sys");
  241. entry.includes.add("/machine");
  242. entry.includes.add("/i386");
  243. entry = new GrepEntry();
  244. grepBase.put(prefix+"/usr/include/c++/4.0.0", entry);
  245. entry.includes.add("/bits");
  246. entry.includes.add("/debug");
  247. entry.includes.add("/ext");
  248. DwarfSource source = getDwarfSource("/org/netbeans/modules/cnd/dwarfdiscovery/provider/cpu-g3-gdwarf-2.leopard.o", system, ignore, grepBase, false, null);
  249. assertNotNull(source);
  250. TreeMap<String, String> map = new TreeMap<String, String>(source.getUserMacros());
  251. assertTrue(compareMap(map, golden));
  252. assertTrue(source.getUserInludePaths().size()==1);
  253. assertEquals(source.getUserInludePaths().get(0), prefix+"/Users/guest/Quote_10");
  254. printInclidePaths(source);
  255. }
  256. public void testCygwin(){
  257. TreeMap<String, String> golden = new TreeMap<String, String>();
  258. golden.put("__CYGWIN32__", "1");
  259. golden.put("__CYGWIN__", "1");
  260. golden.put("unix", "1");
  261. golden.put("__unix__", "1");
  262. golden.put("__unix", "1");
  263. golden.put("AAA", "1");
  264. golden.put("BBB", "11");
  265. TreeMap<String, String> ignore = new TreeMap<String, String>();
  266. List<String> system = new ArrayList<String>();
  267. String prefix = "C:/cygwin";
  268. system.add(prefix+"/usr/include");
  269. system.add(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/i686-pc-cygwin/bits");
  270. system.add(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include");
  271. system.add(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include/c++");
  272. Map<String,GrepEntry> grepBase = new HashMap<String, GrepEntry>();
  273. GrepEntry entry = new GrepEntry();
  274. grepBase.put(prefix+"/usr/include", entry);
  275. entry.includes.add("/sys");
  276. entry.includes.add("/machine");
  277. entry.includes.add("/cygwin");
  278. entry = new GrepEntry();
  279. grepBase.put(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include/c++", entry);
  280. entry.includes.add("/bits");
  281. entry.includes.add("/debug");
  282. entry.includes.add("/ext");
  283. DwarfSource source = getDwarfSource("/org/netbeans/modules/cnd/dwarfdiscovery/provider/quote.cygwin.o", system, ignore, grepBase, true, prefix);
  284. TreeMap<String, String> map = new TreeMap<String, String>(source.getUserMacros());
  285. assertTrue(compareMap(map, golden));
  286. assertTrue(source.getUserInludePaths().size()==1);
  287. assertEquals(source.getUserInludePaths().get(0), "C:/Documents and Settings/tester/My Documents/NetBeansProjects/Quote_1");
  288. printInclidePaths(source);
  289. }
  290. public void testCygwin2(){
  291. TreeMap<String, String> golden = new TreeMap<String, String>();
  292. golden.put("__CYGWIN32__", "1");
  293. golden.put("__CYGWIN__", "1");
  294. golden.put("unix", "1");
  295. golden.put("__unix__", "1");
  296. golden.put("__unix", "1");
  297. golden.put("HAVE_CONFIG_H", "1");
  298. TreeMap<String, String> ignore = new TreeMap<String, String>();
  299. List<String> system = new ArrayList<String>();
  300. String prefix = "D:/cygwin";
  301. system.add(prefix+"/usr/include");
  302. system.add(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/i686-pc-cygwin/bits");
  303. system.add(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include");
  304. system.add(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include/c++");
  305. Map<String,GrepEntry> grepBase = new HashMap<String, GrepEntry>();
  306. GrepEntry entry = new GrepEntry();
  307. grepBase.put(prefix+"/usr/include", entry);
  308. entry.includes.add("/sys");
  309. entry.includes.add("/machine");
  310. entry.includes.add("/cygwin");
  311. entry = new GrepEntry();
  312. grepBase.put(prefix+"/lib/gcc/i686-pc-cygwin/3.4.4/include/c++", entry);
  313. entry.includes.add("/bits");
  314. entry.includes.add("/debug");
  315. entry.includes.add("/ext");
  316. DwarfSource source = getDwarfSource("/org/netbeans/modules/cnd/dwarfdiscovery/provider/string.cygwin.o", system, ignore, grepBase, true, prefix);
  317. assertNotNull(source);
  318. TreeMap<String, String> map = new TreeMap<String, String>(source.getUserMacros());
  319. assertTrue(compareMap(map, golden));
  320. prefix = "D:";
  321. assertTrue(compareLists(source.getUserInludePaths(), new String[]{
  322. "../..",
  323. "./../../include/litesql",
  324. prefix+"/usr_/masha/projects/litesql_latest/litesql-0.3.2/src/library",
  325. prefix+"/usr_/masha/projects/litesql_latest/litesql-0.3.2",
  326. prefix+"/usr_/masha/projects/litesql_latest/litesql-0.3.2/include/litesql"
  327. }));
  328. printInclidePaths(source);
  329. }
  330. public void testGentoo43(){
  331. TreeMap<String, String> golden = new TreeMap<String, String>();
  332. golden.put("COMMAND_LINE_MACROS_1", "1");
  333. golden.put("COMMAND_LINE_MACROS_2", "1");
  334. golden.put("SOURCE_CODE_MACROS_1", "1");
  335. TreeMap<String, String> ignore = new TreeMap<String, String>();
  336. ignore.put("_GNU_SOURCE", "1");
  337. ignore.put("_LP64", "1");
  338. ignore.put("__CHAR_BIT__", "8");
  339. ignore.put("__DBL_DENORM_MIN__", "4.9406564584124654e-324");
  340. ignore.put("__DBL_DIG__", "15");
  341. ignore.put("__DBL_EPSILON__", "2.2204460492503131e-16");
  342. ignore.put("__DBL_HAS_DENORM__", "1");
  343. ignore.put("__DBL_HAS_INFINITY__", "1");
  344. ignore.put("__DBL_HAS_QUIET_NAN__", "1");
  345. ignore.put("__DBL_MANT_DIG__", "53");
  346. ignore.put("__DBL_MAX_10_EXP__", "308");
  347. ignore.put("__DBL_MAX_EXP__", "1024");
  348. ignore.put("__DBL_MAX__", "1.7976931348623157e+308");
  349. ignore.put("__DBL_MIN_10_EXP__", "(-307)");
  350. ignore.put("__DBL_MIN_EXP__", "(-1021)");
  351. ignore.put("__DBL_MIN__", "2.2250738585072014e-308");
  352. ignore.put("__DEC128_DEN__", "0.000000000000000000000000000000001E-6143DL");
  353. ignore.put("__DEC128_EPSILON__", "1E-33DL");
  354. ignore.put("__DEC128_MANT_DIG__", "34");
  355. ignore.put("__DEC128_MAX_EXP__", "6144");
  356. ignore.put("__DEC128_MAX__", "9.999999999999999999999999999999999E6144DL");
  357. ignore.put("__DEC128_MIN_EXP__", "(-6143)");
  358. ignore.put("__DEC128_MIN__", "1E-6143DL");
  359. ignore.put("__DEC32_DEN__", "0.000001E-95DF");
  360. ignore.put("__DEC32_EPSILON__", "1E-6DF");
  361. ignore.put("__DEC32_MANT_DIG__", "7");
  362. ignore.put("__DEC32_MAX_EXP__", "96");
  363. ignore.put("__DEC32_MAX__", "9.999999E96DF");
  364. ignore.put("__DEC32_MIN_EXP__", "(-95)");
  365. ignore.put("__DEC32_MIN__", "1E-95DF");
  366. ignore.put("__DEC64_DEN__", "0.000000000000001E-383DD");
  367. ignore.put("__DEC64_EPSILON__", "1E-15DD");
  368. ignore.put("__DEC64_MANT_DIG__", "16");
  369. ignore.put("__DEC64_MAX_EXP__", "384");
  370. ignore.put("__DEC64_MAX__", "9.999999999999999E384DD");
  371. ignore.put("__DEC64_MIN_EXP__", "(-383)");
  372. ignore.put("__DEC64_MIN__", "1E-383DD");
  373. ignore.put("__DECIMAL_BID_FORMAT__", "1");
  374. ignore.put("__DECIMAL_DIG__", "21");
  375. ignore.put("__DEC_EVAL_METHOD__", "2");
  376. ignore.put("__DEPRECATED", "1");
  377. ignore.put("__ELF__", "1");
  378. ignore.put("__EXCEPTIONS", "1");
  379. ignore.put("__FINITE_MATH_ONLY__", "0");
  380. ignore.put("__FLT_DENORM_MIN__", "1.40129846e-45F");
  381. ignore.put("__FLT_DIG__", "6");
  382. ignore.put("__FLT_EPSILON__", "1.19209290e-7F");
  383. ignore.put("__FLT_EVAL_METHOD__", "0");
  384. ignore.put("__FLT_HAS_DENORM__", "1");
  385. ignore.put("__FLT_HAS_INFINITY__", "1");
  386. ignore.put("__FLT_HAS_QUIET_NAN__", "1");
  387. ignore.put("__FLT_MANT_DIG__", "24");
  388. ignore.put("__FLT_MAX_10_EXP__", "38");
  389. ignore.put("__FLT_MAX_EXP__", "128");
  390. ignore.put("__FLT_MAX__", "3.40282347e+38F");
  391. ignore.put("__FLT_MIN_10_EXP__", "(-37)");
  392. ignore.put("__FLT_MIN_EXP__", "(-125)");
  393. ignore.put("__FLT_MIN__", "1.17549435e-38F");
  394. ignore.put("__FLT_RADIX__", "2");
  395. ignore.put("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1", "1");
  396. ignore.put("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2", "1");
  397. ignore.put("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4", "1");
  398. ignore.put("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8", "1");
  399. ignore.put("__GNUC_GNU_INLINE__", "1");
  400. ignore.put("__GNUC_MINOR__", "3");
  401. ignore.put("__GNUC_PATCHLEVEL__", "2");
  402. ignore.put("__GNUC__", "4");
  403. ignore.put("__GNUG__", "4");
  404. ignore.put("__GXX_ABI_VERSION", "1002");
  405. ignore.put("__GXX_RTTI", "1");
  406. ignore.put("__GXX_WEAK__", "1");
  407. ignore.put("__INTMAX_MAX__", "9223372036854775807L");
  408. ignore.put("__INTMAX_TYPE__", "long int");
  409. ignore.put("__INT_MAX__", "2147483647");
  410. ignore.put("__LDBL_DENORM_MIN__", "3.64519953188247460253e-4951L");
  411. ignore.put("__LDBL_DIG__", "18");
  412. ignore.put("__LDBL_EPSILON__", "1.08420217248550443401e-19L");
  413. ignore.put("__LDBL_HAS_DENORM__", "1");
  414. ignore.put("__LDBL_HAS_INFINITY__", "1");
  415. ignore.put("__LDBL_HAS_QUIET_NAN__", "1");
  416. ignore.put("__LDBL_MANT_DIG__", "64");
  417. ignore.put("__LDBL_MAX_10_EXP__", "4932");
  418. ignore.put("__LDBL_MAX_EXP__", "16384");
  419. ignore.put("__LDBL_MAX__", "1.18973149535723176502e+4932L");
  420. ignore.put("__LDBL_MIN_10_EXP__", "(-4931)");
  421. ignore.put("__LDBL_MIN_EXP__", "(-16381)");
  422. ignore.put("__LDBL_MIN__", "3.36210314311209350626e-4932L");
  423. ignore.put("__LONG_LONG_MAX__", "9223372036854775807LL");
  424. ignore.put("__LONG_MAX__", "9223372036854775807L");
  425. ignore.put("__LP64__", "1");
  426. ignore.put("__MMX__", "1");
  427. ignore.put("__NO_INLINE__", "1");
  428. ignore.put("__PTRDIFF_TYPE__", "long int");
  429. ignore.put("__REGISTER_PREFIX__", "");
  430. ignore.put("__SCHAR_MAX__", "127");
  431. ignore.put("__SHRT_MAX__", "32767");
  432. ignore.put("__SIZEOF_DOUBLE__", "8");
  433. ignore.put("__SIZEOF_FLOAT__", "4");
  434. ignore.put("__SIZEOF_INT__", "4");
  435. ignore.put("__SIZEOF_LONG_DOUBLE__", "16");
  436. ignore.put("__SIZEOF_LONG_LONG__", "8");
  437. ignore.put("__SIZEOF_LONG__", "8");
  438. ignore.put("__SIZEOF_POINTER__", "8");
  439. ignore.put("__SIZEOF_PTRDIFF_T__", "8");
  440. ignore.put("__SIZEOF_SHORT__", "2");
  441. ignore.put("__SIZEOF_SIZE_T__", "8");
  442. ignore.put("__SIZEOF_WCHAR_T__", "4");
  443. ignore.put("__SIZEOF_WINT_T__", "4");
  444. ignore.put("__SIZE_TYPE__", "long unsigned int");
  445. ignore.put("__SSE2_MATH__", "1");
  446. ignore.put("__SSE2__", "1");
  447. ignore.put("__SSE_MATH__", "1");
  448. ignore.put("__SSE__", "1");
  449. ignore.put("__STDC_HOSTED__", "1");
  450. ignore.put("__STDC__", "1");
  451. ignore.put("__UINTMAX_TYPE__", "long unsigned int");
  452. ignore.put("__USER_LABEL_PREFIX__", "");
  453. ignore.put("__VERSION__", "\"4.3.2\"");
  454. ignore.put("__WCHAR_MAX__", "2147483647");
  455. ignore.put("__WCHAR_TYPE__", "int");
  456. ignore.put("__WINT_TYPE__", "unsigned int");
  457. ignore.put("__amd64", "1");
  458. ignore.put("__amd64__", "1");
  459. ignore.put("__cplusplus", "1");
  460. ignore.put("__gnu_linux__", "1");
  461. ignore.put("__k8", "1");
  462. ignore.put("__k8__", "1");
  463. ignore.put("__linux", "1");
  464. ignore.put("__linux__", "1");
  465. ignore.put("__unix", "1");
  466. ignore.put("__unix__", "1");
  467. ignore.put("__x86_64", "1");
  468. ignore.put("__x86_64__", "1");
  469. ignore.put("linux", "1");
  470. ignore.put("unix", "1");
  471. List<String> system = new ArrayList<String>();
  472. String prefix = "";
  473. system.add(prefix+"/usr/include");
  474. system.add(prefix+"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include");
  475. system.add(prefix+"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4");
  476. system.add(prefix+"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/x86_64-pc-linux-gnu/bits");
  477. Map<String,GrepEntry> grepBase = new HashMap<String, GrepEntry>();
  478. GrepEntry entry = new GrepEntry();
  479. grepBase.put(prefix+"/usr/include", entry);
  480. entry.includes.add("/sys");
  481. entry.includes.add("/bits");
  482. entry.includes.add("/gnu");
  483. entry = new GrepEntry();
  484. grepBase.put(prefix+"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4", entry);
  485. entry.includes.add("/bits");
  486. entry.includes.add("/debug");
  487. entry.includes.add("/ext");
  488. entry.includes.add("/backward");
  489. DwarfSource source = getDwarfSource("/org/netbeans/modules/cnd/dwarfdiscovery/provider/cpu.gentoo.4.3.o", system, ignore, grepBase, false, null);
  490. assertNotNull(source);
  491. TreeMap<String, String> map = new TreeMap<String, String>(source.getUserMacros());
  492. assertTrue(compareMap(map, golden));
  493. assertTrue(source.getUserInludePaths().size()==1);
  494. assertEquals(source.getUserInludePaths().get(0), prefix+"/export/home/av202691/NetBeansProjects/Quote_1");
  495. printInclidePaths(source);
  496. }
  497. public void testRedhat(){
  498. TreeMap<String, String> golden = new TreeMap<String, String>();
  499. golden.put("HAVE_CONFIG_H", "1");
  500. golden.put("HTIOP_BUILD_DLL", "1");
  501. golden.put("PIC", "1");
  502. TreeMap<String, String> ignore = new TreeMap<String, String>();
  503. ignore.put("_GNU_SOURCE", "1");
  504. ignore.put("_LP64", "1");
  505. ignore.put("_REENTRANT", "1");
  506. ignore.put("__CHAR_BIT__", "8");
  507. ignore.put("__DBL_DENORM_MIN__", "4.9406564584124654e-324");
  508. ignore.put("__DBL_DIG__", "15");
  509. ignore.put("__DBL_EPSILON__", "2.2204460492503131e-16");
  510. ignore.put("__DBL_HAS_INFINITY__", "1");
  511. ignore.put("__DBL_HAS_QUIET_NAN__", "1");
  512. ignore.put("__DBL_MANT_DIG__", "53");
  513. ignore.put("__DBL_MAX_10_EXP__", "308");
  514. ignore.put("__DBL_MAX_EXP__", "1024");
  515. ignore.put("__DBL_MAX__", "1.7976931348623157e+308");
  516. ignore.put("__DBL_MIN_10_EXP__", "(-307)");
  517. ignore.put("__DBL_MIN_EXP__", "(-1021)");
  518. ignore.put("__DBL_MIN__", "2.2250738585072014e-308");
  519. ignore.put("__DECIMAL_DIG__", "21");
  520. ignore.put("__DEPRECATED", "1");
  521. ignore.put("__ELF__", "1");
  522. ignore.put("__EXCEPTIONS", "1");
  523. ignore.put("__FINITE_MATH_ONLY__", "0");
  524. ignore.put("__FLT_DENORM_MIN__", "1.40129846e-45F");
  525. ignore.put("__FLT_DIG__", "6");
  526. ignore.put("__FLT_EPSILON__", "1.19209290e-7F");
  527. ignore.put("__FLT_EVAL_METHOD__", "0");
  528. ignore.put("__FLT_HAS_INFINITY__", "1");
  529. ignore.put("__FLT_HAS_QUIET_NAN__", "1");
  530. ignore.put("__FLT_MANT_DIG__", "24");
  531. ignore.put("__FLT_MAX_10_EXP__", "38");
  532. ignore.put("__FLT_MAX_EXP__", "128");
  533. ignore.put("__FLT_MAX__", "3.40282347e+38F");
  534. ignore.put("__FLT_MIN_10_EXP__", "(-37)");
  535. ignore.put("__FLT_MIN_EXP__", "(-125)");
  536. ignore.put("__FLT_MIN__", "1.17549435e-38F");
  537. ignore.put("__FLT_RADIX__", "2");
  538. ignore.put("__GNUC_GNU_INLINE__", "1");
  539. ignore.put("__GNUC_MINOR__", "1");
  540. ignore.put("__GNUC_PATCHLEVEL__", "2");
  541. ignore.put("__GNUC_RH_RELEASE__", "42");
  542. ignore.put("__GNUC__", "4");
  543. ignore.put("__GNUG__", "4");
  544. ignore.put("__GXX_ABI_VERSION", "1002");
  545. ignore.put("__GXX_WEAK__", "1");
  546. ignore.put("__INTMAX_MAX__", "9223372036854775807L");
  547. ignore.put("__INTMAX_TYPE__", "long int");
  548. ignore.put("__INT_MAX__", "2147483647");
  549. ignore.put("__LDBL_DENORM_MIN__", "3.64519953188247460253e-4951L");
  550. ignore.put("__LDBL_DIG__", "18");
  551. ignore.put("__LDBL_EPSILON__", "1.08420217248550443401e-19L");
  552. ignore.put("__LDBL_HAS_INFINITY__", "1");
  553. ignore.put("__LDBL_HAS_QUIET_NAN__", "1");
  554. ignore.put("__LDBL_MANT_DIG__", "64");
  555. ignore.put("__LDBL_MAX_10_EXP__", "4932");
  556. ignore.put("__LDBL_MAX_EXP__", "16384");
  557. ignore.put("__LDBL_MAX__", "1.18973149535723176502e+4932L");
  558. ignore.put("__LDBL_MIN_10_EXP__", "(-4931)");
  559. ignore.put("__LDBL_MIN_EXP__", "(-16381)");
  560. ignore.put("__LDBL_MIN__", "3.36210314311209350626e-4932L");
  561. ignore.put("__LONG_LONG_MAX__", "9223372036854775807LL");
  562. ignore.put("__LONG_MAX__", "9223372036854775807L");
  563. ignore.put("__LP64__", "1");
  564. ignore.put("__MMX__", "1");
  565. ignore.put("__NO_INLINE__", "1");
  566. ignore.put("__PIC__", "1");
  567. ignore.put("__PTRDIFF_TYPE__", "long int");
  568. ignore.put("__REGISTER_PREFIX__", "");
  569. ignore.put("__SCHAR_MAX__", "127");
  570. ignore.put("__SHRT_MAX__", "32767");
  571. ignore.put("__SIZE_TYPE__", "long unsigned int");
  572. ignore.put("__SSE2_MATH__", "1");
  573. ignore.put("__SSE2__", "1");
  574. ignore.put("__SSE_MATH__", "1");
  575. ignore.put("__SSE__", "1");
  576. ignore.put("__STDC_HOSTED__", "1");
  577. ignore.put("__STDC__", "1");
  578. ignore.put("__UINTMAX_TYPE__", "long unsigned int");
  579. ignore.put("__USER_LABEL_PREFIX__", "");
  580. ignore.put("__VERSION__", "\"4.1.2 20071124 (Red Hat 4.1.2-42)\"");
  581. ignore.put("__WCHAR_MAX__", "2147483647");
  582. ignore.put("__WCHAR_TYPE__", "int");
  583. ignore.put("__WINT_TYPE__", "unsigned int");
  584. ignore.put("__amd64", "1");
  585. ignore.put("__amd64__", "1");
  586. ignore.put("__cplusplus", "1");
  587. ignore.put("__gnu_linux__", "1");
  588. ignore.put("__k8", "1");
  589. ignore.put("__k8__", "1");
  590. ignore.put("__linux", "1");
  591. ignore.put("__linux__", "1");
  592. ignore.put("__pic__", "1");
  593. ignore.put("__unix", "1");
  594. ignore.put("__unix__", "1");
  595. ignore.put("__x86_64", "1");
  596. ignore.put("__x86_64__", "1");
  597. ignore.put("linux", "1");
  598. ignore.put("unix", "1");
  599. List<String> system = new ArrayList<String>();
  600. String prefix = "";
  601. system.add(prefix+"/usr/include");
  602. system.add(prefix+"/usr/include/c++/4.1.2");
  603. system.add(prefix+"/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include");
  604. system.add(prefix+"/usr/include/c++/4.1.2/x86_64-redhat-linux/bits");
  605. Map<String,GrepEntry> grepBase = new HashMap<String, GrepEntry>();
  606. GrepEntry entry = new GrepEntry();
  607. grepBase.put(prefix+"/usr/include", entry);
  608. entry.includes.add("/sys");
  609. entry.includes.add("/bits");
  610. entry.includes.add("/gnu");
  611. entry.includes.add("/linux");
  612. entry.includes.add("/asm");
  613. entry.includes.add("/asm-x86_64");
  614. entry.includes.add("/asm-generic");
  615. entry = new GrepEntry();
  616. grepBase.put(prefix+"/usr/include/c++/4.1.2", entry);
  617. entry.includes.add("/bits");
  618. entry.includes.add("/debug");
  619. entry.includes.add("/ext");
  620. GrepEntry grep =new GrepEntry();
  621. grep.firstMacro="HTIOP_ACCEPTOR_IMPL_CPP";
  622. grep.firstMacroLine=4;
  623. String name = "/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp";
  624. if (Utilities.isWindows()) {
  625. name = "C:\\net\\dxespb04x127x81\\export\\devarea\\osprojects\\ACE_TAO\\ACE_wrappers\\TAO\\orbsvcs\\orbsvcs\\HTIOP\\HTIOP_Acceptor_Impl.cpp";
  626. }
  627. grepBase.put(name, grep);
  628. if (Utilities.isWindows()) {
  629. name = "D:\\net\\dxespb04x127x81\\export\\devarea\\osprojects\\ACE_TAO\\ACE_wrappers\\TAO\\orbsvcs\\orbsvcs\\HTIOP\\HTIOP_Acceptor_Impl.cpp";
  630. grepBase.put(name, grep);
  631. }
  632. DwarfSource source = getDwarfSource("/org/netbeans/modules/cnd/dwarfdiscovery/provider/x86_64-redhat-4.1.2.o", system, ignore, grepBase, false, null);
  633. assertNotNull(source);
  634. TreeMap<String, String> map = new TreeMap<String, String>(source.getUserMacros());
  635. assertTrue(compareMap(map, golden));
  636. assertTrue(compareLists(source.getUserInludePaths(), new String[]{
  637. "../../../../TAO/orbsvcs/orbsvcs/HTIOP",
  638. "../../../../TAO/../ace",
  639. "../../../ace",
  640. "../../../../TAO/../ace/os_include/sys",
  641. "../../../../TAO/../ace/os_include",
  642. "../../../../TAO/../ace/os_include/netinet",
  643. prefix+"/usr/include/netinet",
  644. "../../../../TAO/../ace/os_include/net",
  645. prefix+"/usr/include/net",
  646. "../../../../TAO/../ace/os_include/arpa",
  647. prefix+"/usr/include/arpa",
  648. "../../../../TAO/tao",
  649. "../../tao",
  650. "../../orbsvcs/orbsvcs",
  651. "../../../../TAO/tao/AnyTypeCode",
  652. "../../../../TAO/../protocols/ace/HTBP",
  653. prefix+"/usr/include/rpc",
  654. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/TAO/orbsvcs/orbsvcs/HTIOP",
  655. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/ace",
  656. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/build/ace",
  657. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/ace/os_include/sys",
  658. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/ace/os_include",
  659. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/ace/os_include/netinet",
  660. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/ace/os_include/net",
  661. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/ace/os_include/arpa",
  662. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/TAO/tao",
  663. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/build/TAO/tao",
  664. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/build/TAO/orbsvcs/orbsvcs",
  665. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/TAO/tao/AnyTypeCode",
  666. prefix+"/net/dxespb04x127x81/export/devarea/osprojects/ACE_TAO/ACE_wrappers/protocols/ace/HTBP"
  667. // next dirs are detected if source file is available
  668. //"../../../../TAO/orbsvcs",
  669. //"../../../../TAO/../protocols",
  670. //"../../../../TAO",
  671. //"../../../../TAO/..",
  672. //"../../..",
  673. //"../..",
  674. //"../../orbsvcs"
  675. }));
  676. printInclidePaths(source);
  677. }
  678. private boolean compareMap(TreeMap<String, String> result, TreeMap<String, String> golden) {
  679. boolean res = true;
  680. for (Map.Entry<String,String> entry : result.entrySet()) {
  681. if (golden.containsKey(entry.getKey())){
  682. continue;
  683. }
  684. //printError("Redundant entry ", entry);
  685. System.err.println("ignore.put(\""+entry.getKey()+"\", \""+entry.getValue()+"\");");
  686. res = false;
  687. }
  688. for (Map.Entry<String,String> entry : golden.entrySet()) {
  689. if (result.containsKey(entry.getKey())){
  690. continue;
  691. }
  692. //printError("Not found entry ", entry);
  693. System.err.println("golden.put(\""+entry.getKey()+"\", \""+entry.getValue()+"\");");
  694. res = false;
  695. }
  696. return res;
  697. }
  698. private boolean compareLists(List<String> result, String[] golden){
  699. Loop:for(String x : result){
  700. for(String g : golden) {
  701. if (x.equals(g)) {
  702. continue Loop;
  703. }
  704. }
  705. System.err.println("Result:"+x+" not found in golden");
  706. return false;
  707. }
  708. Loop:for(String g : golden) {
  709. for(String x : result){
  710. if (x.equals(g)) {
  711. continue Loop;
  712. }
  713. }
  714. System.err.println("Golden:"+g+" not found in results");
  715. return false;
  716. }
  717. if (result.size() != golden.length) {
  718. System.err.println("Result size:"+result.size()+" not equals golden size:"+golden.length);
  719. return false;
  720. }
  721. return true;
  722. }
  723. private void printError(String message, Map.Entry<String,String> entry){
  724. if (true) {
  725. if (entry.getValue() == null) {
  726. System.err.println(message+" "+entry.getKey());
  727. } else {
  728. System.err.println(message+" "+entry.getKey()+"="+entry.getValue());
  729. }
  730. }
  731. }
  732. private void printInclidePaths(DwarfSource source){
  733. if (false) {
  734. System.err.println("User include paths for file "+source.getItemPath());
  735. for(String p : source.getUserInludePaths()){
  736. System.err.println("\t"+p);
  737. }
  738. System.err.println("System include paths for file "+source.getItemPath());
  739. for(String p : source.getSystemInludePaths()){
  740. System.err.println("\t"+p);
  741. }
  742. }
  743. }
  744. private DwarfSource getDwarfSource(String resource, final List<String> systemPath,
  745. final Map<String, String> ignore, final Map<String,GrepEntry> grepBase,
  746. final boolean isWindows, final String cygwinPath){
  747. File dataDir = getDataDir();
  748. String objFileName = dataDir.getAbsolutePath()+resource;
  749. Dwarf dump = null;
  750. try {
  751. dump = new Dwarf(objFileName);
  752. CompilationUnitIterator units = dump.iteratorCompilationUnits();
  753. if (units != null && units.hasNext()) {
  754. while (units.hasNext()) {
  755. CompilationUnitInterface cu = units.next();
  756. CompilerSettings settings = new CompilerSettings(new ProjectProxy() {
  757. @Override
  758. public boolean createSubProjects() { return false; }
  759. @Override
  760. public Project getProject() { return null; }
  761. @Override
  762. public String getMakefile() { return null; }
  763. @Override
  764. public String getSourceRoot() { return null; }
  765. @Override
  766. public String getExecutable() { return null; }
  767. @Override
  768. public String getWorkingFolder() { return null; }
  769. @Override
  770. public boolean mergeProjectProperties() { return false;}
  771. }){
  772. @Override
  773. public Map<String, String> getSystemMacroDefinitions(ItemProperties.LanguageKind lang) {
  774. return ignore;
  775. }
  776. @Override
  777. public List<String> getSystemIncludePaths(ItemProperties.LanguageKind lang) {
  778. return systemPath;
  779. }
  780. @Override
  781. public CompilerFlavor getCompileFlavor() {
  782. return CompilerFlavor.toFlavor("Cygwin", PlatformTypes.PLATFORM_WINDOWS);
  783. }
  784. @Override
  785. public String getCygwinDrive() {
  786. if (cygwinPath != null) {
  787. return cygwinPath;
  788. }
  789. return super.getCygwinDrive();
  790. }
  791. @Override
  792. public boolean isWindows() {
  793. return isWindows;
  794. }
  795. @Override
  796. protected String normalizePath(String path) {
  797. //if (isWindows == Utilities.isWindows()) {
  798. // return super.normalizePath(path);
  799. //}
  800. path = path.replace('\\', '/');
  801. while (path.indexOf("/..") > 0) {
  802. int i = path.indexOf("/..");
  803. String beg = path.substring(0,i);
  804. String rest = path.substring(i+3);
  805. if (beg.endsWith(".")) {
  806. break;
  807. }
  808. int j = beg.lastIndexOf('/');
  809. if (j < 0) {
  810. break;
  811. }
  812. path = beg.substring(0,j)+rest;
  813. }
  814. return path;
  815. }
  816. };
  817. DwarfSource source = new DwarfSource(cu, ItemProperties.LanguageKind.C, ItemProperties.LanguageStandard.C, settings, grepBase, null);
  818. source.process(cu);
  819. return source;
  820. }
  821. }
  822. } catch (FileNotFoundException ex) {
  823. Exceptions.printStackTrace(ex);
  824. } catch (WrongFileFormatException ex) {
  825. Exceptions.printStackTrace(ex);
  826. } catch (IOException ex) {
  827. Exceptions.printStackTrace(ex);
  828. } finally {
  829. if (dump != null) {
  830. dump.dispose();
  831. }
  832. }
  833. return null;
  834. }
  835. }