ad056b
From e7ff390ef777bd818ccc6e6f8f3a56f36020abfe Mon Sep 17 00:00:00 2001
ad056b
From: Mat Booth <mat.booth@gmail.com>
ad056b
Date: Wed, 15 Sep 2021 10:21:53 +0100
ad056b
Subject: [PATCH 1/2] Always generate bytecode debuginfo
ad056b
ad056b
When ecj is used to build RPMs
ad056b
---
ad056b
 .../jdt/internal/compiler/batch/Main.java     | 23 +++++++++++++++++++
ad056b
 1 file changed, 23 insertions(+)
ad056b
ad056b
diff --git a/org/eclipse/jdt/internal/compiler/batch/Main.java b/org/eclipse/jdt/internal/compiler/batch/Main.java
ad056b
index f77372d..73a0d24 100644
ad056b
--- a/org/eclipse/jdt/internal/compiler/batch/Main.java
ad056b
+++ b/org/eclipse/jdt/internal/compiler/batch/Main.java
ad056b
@@ -3109,6 +3109,29 @@ public void configure(String[] argv) {
ad056b
 		this.options.put(CompilerOptions.OPTION_Process_Annotations, CompilerOptions.ENABLED);
ad056b
 	}
ad056b
 
ad056b
+	{
ad056b
+		// If we're building an RPM, force full debugging info to
ad056b
+		// be generated, no matter what options have been passed
ad056b
+		// by Ant.  This is something of a kludge, but it is far
ad056b
+		// better than the alternative, which is having class
ad056b
+		// files with debug info mysteriously missing.
ad056b
+
ad056b
+		String RpmPackageName = System.getenv("RPM_PACKAGE_NAME");
ad056b
+		String RpmArch = System.getenv("RPM_ARCH");
ad056b
+		String RpmBuildRoot = System.getenv("RPM_BUILD_ROOT");
ad056b
+		if (RpmPackageName != null && RpmArch != null && RpmBuildRoot != null) {
ad056b
+			this.options.put(
ad056b
+					CompilerOptions.OPTION_LocalVariableAttribute,
ad056b
+					CompilerOptions.GENERATE);
ad056b
+			this.options.put(
ad056b
+					CompilerOptions.OPTION_LineNumberAttribute,
ad056b
+					CompilerOptions.GENERATE);
ad056b
+			this.options.put(
ad056b
+					CompilerOptions.OPTION_SourceFileAttribute,
ad056b
+					CompilerOptions.GENERATE);
ad056b
+		}
ad056b
+	}
ad056b
+
ad056b
 	this.logger.logCommandLineArguments(newCommandLineArgs);
ad056b
 	this.logger.logOptions(this.options);
ad056b
 
ad056b
-- 
ad056b
2.31.1
ad056b