|
| 1 | +# LLDB Fortran Support - Implementation Backlog |
| 2 | + |
| 3 | +## Epic 1: Development Environment Setup |
| 4 | +**Status**: 🔵 Ready |
| 5 | +**Goal**: Establish efficient development and testing environment |
| 6 | + |
| 7 | +### Story 1.1: Minimal Build Configuration |
| 8 | +- [ ] Create optimal CMake configuration for Fortran LLDB development |
| 9 | +- [ ] Document build time and disk space requirements |
| 10 | +- [ ] Verify build works with both Debug and Release configurations |
| 11 | +- [ ] Test with different generators (Ninja, Make) |
| 12 | + |
| 13 | +**Acceptance Criteria**: |
| 14 | +- Build completes in under 30 minutes on standard hardware |
| 15 | +- Only necessary targets are built (LLDB + minimal dependencies) |
| 16 | +- Debug symbols available for development |
| 17 | + |
| 18 | +**Test Cases**: |
| 19 | +- Build with gfortran available |
| 20 | +- Build with flang available |
| 21 | +- Build without Fortran compilers (should still work) |
| 22 | + |
| 23 | +### Story 1.2: Test Infrastructure Foundation |
| 24 | +- [ ] Set up basic test structure in `lldb/test/API/lang/fortran/` |
| 25 | +- [ ] Create simple Fortran test programs (.f90 files) |
| 26 | +- [ ] Establish lit test configuration |
| 27 | +- [ ] Add CMake integration for Fortran tests |
| 28 | + |
| 29 | +**Acceptance Criteria**: |
| 30 | +- Test directory structure follows LLDB conventions |
| 31 | +- Tests can be run individually and in suites |
| 32 | +- CI-friendly test execution |
| 33 | + |
| 34 | +**Test Cases**: |
| 35 | +- Run single Fortran test |
| 36 | +- Run full Fortran test suite |
| 37 | +- Tests work with both gfortran and flang |
| 38 | + |
| 39 | +### Story 1.3: Continuous Integration Setup |
| 40 | +- [ ] Create GitHub Actions workflow for Fortran tests |
| 41 | +- [ ] Set up test matrix (multiple compilers, platforms) |
| 42 | +- [ ] Configure test result reporting |
| 43 | +- [ ] Add performance benchmarking |
| 44 | + |
| 45 | +**Acceptance Criteria**: |
| 46 | +- Tests run automatically on PR submission |
| 47 | +- Results clearly visible in PR status |
| 48 | +- Performance regressions are detected |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## Epic 2: Phase 1 - Minimal Viable Plugin (MVP) |
| 53 | +**Status**: 🔵 Ready |
| 54 | +**Goal**: Eliminate "no plugin" warning, basic language recognition |
| 55 | + |
| 56 | +### Story 2.1: Plugin Registration Infrastructure (RED) |
| 57 | +- [ ] Create `lldb/source/Plugins/Language/Fortran/` directory structure |
| 58 | +- [ ] Implement basic `FortranLanguage.h` class declaration |
| 59 | +- [ ] Add plugin registration in PluginManager |
| 60 | +- [ ] Write failing test for language recognition |
| 61 | + |
| 62 | +**Acceptance Criteria**: |
| 63 | +- LLDB recognizes Fortran as a supported language |
| 64 | +- No "unsupported language" warnings for Fortran files |
| 65 | +- Plugin loads without errors |
| 66 | + |
| 67 | +**Test Cases (RED phase)**: |
| 68 | +```python |
| 69 | +# Test: test_fortran_language_recognition.py |
| 70 | +def test_fortran_language_detected(self): |
| 71 | + """Test that LLDB recognizes Fortran source files""" |
| 72 | + # This should FAIL initially |
| 73 | + self.expect("settings show target.language", |
| 74 | + substrs=["fortran"]) |
| 75 | +``` |
| 76 | + |
| 77 | +### Story 2.2: Language Type Recognition (GREEN) |
| 78 | +- [ ] Implement `GetLanguageType()` method |
| 79 | +- [ ] Add support for all Fortran standards (F77, F90, F95, F2003, F2008, F2018) |
| 80 | +- [ ] Implement source file extension recognition |
| 81 | +- [ ] Make the RED test pass |
| 82 | + |
| 83 | +**Acceptance Criteria**: |
| 84 | +- LLDB correctly identifies Fortran language from DWARF |
| 85 | +- All Fortran file extensions recognized (.f, .f90, .f95, etc.) |
| 86 | +- Language enum values properly handled |
| 87 | + |
| 88 | +**Test Cases (GREEN phase)**: |
| 89 | +```python |
| 90 | +def test_fortran_file_extensions(self): |
| 91 | + """Test recognition of various Fortran file extensions""" |
| 92 | + extensions = ['.f', '.f90', '.f95', '.f03', '.f08', '.f18'] |
| 93 | + for ext in extensions: |
| 94 | + # Should now PASS |
| 95 | + self.assertTrue(is_fortran_file(f"test{ext}")) |
| 96 | +``` |
| 97 | + |
| 98 | +### Story 2.3: Basic Plugin Methods (REFACTOR) |
| 99 | +- [ ] Implement required Language base class methods |
| 100 | +- [ ] Add proper error handling and logging |
| 101 | +- [ ] Optimize plugin loading performance |
| 102 | +- [ ] Add comprehensive documentation |
| 103 | + |
| 104 | +**Acceptance Criteria**: |
| 105 | +- All Language interface methods implemented |
| 106 | +- Code follows LLVM coding standards |
| 107 | +- No memory leaks or performance regressions |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Epic 3: Phase 2 - Type System Foundation |
| 112 | +**Status**: ⏳ Waiting |
| 113 | +**Dependencies**: Epic 2 complete |
| 114 | + |
| 115 | +### Story 3.1: DWARF Fortran Type Parsing (RED) |
| 116 | +- [ ] Research DWARF format for Fortran types |
| 117 | +- [ ] Write failing tests for COMPLEX type detection |
| 118 | +- [ ] Write failing tests for CHARACTER type detection |
| 119 | +- [ ] Write failing tests for Fortran array types |
| 120 | + |
| 121 | +**Test Cases (RED phase)**: |
| 122 | +```python |
| 123 | +def test_complex_variable_display(self): |
| 124 | + """Test COMPLEX variable is displayed correctly""" |
| 125 | + # Should FAIL initially - shows as unknown type |
| 126 | + self.expect("frame variable complex_var", |
| 127 | + substrs=["(1.0, 2.0)"]) # Expected format |
| 128 | +``` |
| 129 | + |
| 130 | +### Story 3.2: COMPLEX Type Support (GREEN) |
| 131 | +- [ ] Implement COMPLEX type formatter |
| 132 | +- [ ] Handle both single and double precision COMPLEX |
| 133 | +- [ ] Support real and imaginary part access |
| 134 | +- [ ] Make COMPLEX tests pass |
| 135 | + |
| 136 | +**Acceptance Criteria**: |
| 137 | +- COMPLEX variables display as "(real, imag)" format |
| 138 | +- Individual real/imaginary parts accessible |
| 139 | +- Both COMPLEX and DOUBLE COMPLEX supported |
| 140 | + |
| 141 | +### Story 3.3: CHARACTER Type Support (GREEN) |
| 142 | +- [ ] Implement CHARACTER type formatter |
| 143 | +- [ ] Handle fixed-length CHARACTER variables |
| 144 | +- [ ] Support CHARACTER array display |
| 145 | +- [ ] Handle character length attribute from DWARF |
| 146 | + |
| 147 | +**Acceptance Criteria**: |
| 148 | +- CHARACTER variables show string content and length |
| 149 | +- Null termination handled correctly |
| 150 | +- CHARACTER arrays display properly |
| 151 | + |
| 152 | +### Story 3.4: LOGICAL Type Support (GREEN) |
| 153 | +- [ ] Implement LOGICAL type formatter |
| 154 | +- [ ] Map LOGICAL values to .TRUE./.FALSE. |
| 155 | +- [ ] Handle different LOGICAL kinds |
| 156 | + |
| 157 | +**Acceptance Criteria**: |
| 158 | +- LOGICAL variables display as .TRUE. or .FALSE. |
| 159 | +- Different LOGICAL kinds supported |
| 160 | + |
| 161 | +### Story 3.5: Basic Array Support (GREEN) |
| 162 | +- [ ] Implement Fortran array bounds display |
| 163 | +- [ ] Show array dimensions and size |
| 164 | +- [ ] Handle 1-based indexing display |
| 165 | +- [ ] Support multi-dimensional arrays |
| 166 | + |
| 167 | +**Acceptance Criteria**: |
| 168 | +- Arrays show bounds and dimensions |
| 169 | +- 1-based indexing properly displayed |
| 170 | +- Multi-dimensional arrays readable |
| 171 | + |
| 172 | +### Story 3.6: Type System Refactoring (REFACTOR) |
| 173 | +- [ ] Optimize type detection performance |
| 174 | +- [ ] Consolidate common formatter code |
| 175 | +- [ ] Add comprehensive type system tests |
| 176 | +- [ ] Document type system architecture |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## Epic 4: Phase 3 - Expression Evaluation |
| 181 | +**Status**: ⏳ Waiting |
| 182 | +**Dependencies**: Epic 3 complete |
| 183 | + |
| 184 | +### Story 4.1: Basic Expression Parser (RED) |
| 185 | +- [ ] Write failing tests for simple Fortran expressions |
| 186 | +- [ ] Research LLDB expression evaluation architecture |
| 187 | +- [ ] Design Fortran expression parser interface |
| 188 | + |
| 189 | +**Test Cases (RED phase)**: |
| 190 | +```python |
| 191 | +def test_fortran_expression_evaluation(self): |
| 192 | + """Test basic Fortran expression evaluation""" |
| 193 | + # Should FAIL initially |
| 194 | + self.expect("expression -- my_var + 1", |
| 195 | + substrs=["3"]) # If my_var = 2 |
| 196 | +``` |
| 197 | + |
| 198 | +### Story 4.2: Case-Insensitive Identifier Resolution (GREEN) |
| 199 | +- [ ] Implement case-insensitive variable lookup |
| 200 | +- [ ] Handle Fortran naming conventions |
| 201 | +- [ ] Support compiler-specific name mangling |
| 202 | + |
| 203 | +**Acceptance Criteria**: |
| 204 | +- Variables accessible regardless of case in expression |
| 205 | +- Proper symbol resolution for different compilers |
| 206 | + |
| 207 | +### Story 4.3: Fortran Operators (GREEN) |
| 208 | +- [ ] Implement Fortran-specific operators (**, .EQ., .NE., etc.) |
| 209 | +- [ ] Handle operator precedence |
| 210 | +- [ ] Support logical operators (.AND., .OR., .NOT.) |
| 211 | + |
| 212 | +**Acceptance Criteria**: |
| 213 | +- All Fortran operators work in expressions |
| 214 | +- Correct operator precedence |
| 215 | +- Logical operations produce LOGICAL results |
| 216 | + |
| 217 | +### Story 4.4: Basic Intrinsic Functions (GREEN) |
| 218 | +- [ ] Implement SIZE intrinsic function |
| 219 | +- [ ] Implement LBOUND/UBOUND intrinsics |
| 220 | +- [ ] Implement SHAPE intrinsic |
| 221 | +- [ ] Add LEN intrinsic for CHARACTER |
| 222 | + |
| 223 | +**Acceptance Criteria**: |
| 224 | +- Array intrinsics return correct values |
| 225 | +- Character intrinsics work properly |
| 226 | +- Error handling for invalid arguments |
| 227 | + |
| 228 | +--- |
| 229 | + |
| 230 | +## Epic 5: Phase 4 - Advanced Features |
| 231 | +**Status**: ⏳ Waiting |
| 232 | +**Dependencies**: Epic 4 complete |
| 233 | + |
| 234 | +### Story 5.1: Derived Type Support |
| 235 | +- [ ] Parse Fortran derived types from DWARF |
| 236 | +- [ ] Display derived type components |
| 237 | +- [ ] Support type-bound procedures |
| 238 | +- [ ] Handle inheritance |
| 239 | + |
| 240 | +### Story 5.2: Module and Interface Support |
| 241 | +- [ ] Support module variable access |
| 242 | +- [ ] Handle USE association |
| 243 | +- [ ] Support interface blocks |
| 244 | +- [ ] Generic procedure resolution |
| 245 | + |
| 246 | +### Story 5.3: Advanced Array Features |
| 247 | +- [ ] Array sections and slicing |
| 248 | +- [ ] Assumed-shape and deferred-shape arrays |
| 249 | +- [ ] Allocatable and pointer arrays |
| 250 | +- [ ] Array intrinsic functions |
| 251 | + |
| 252 | +### Story 5.4: Parameterized Derived Types (PDTs) |
| 253 | +- [ ] Support length and kind parameters |
| 254 | +- [ ] Handle parameterized type instantiation |
| 255 | +- [ ] Display parameter values |
| 256 | + |
| 257 | +--- |
| 258 | + |
| 259 | +## Epic 6: Documentation and Community |
| 260 | +**Status**: 🔵 Ready (parallel to development) |
| 261 | + |
| 262 | +### Story 6.1: User Documentation |
| 263 | +- [ ] Create Fortran debugging tutorial |
| 264 | +- [ ] Document limitations and known issues |
| 265 | +- [ ] Provide compiler-specific guidance |
| 266 | +- [ ] Add troubleshooting guide |
| 267 | + |
| 268 | +### Story 6.2: Developer Documentation |
| 269 | +- [ ] Document plugin architecture decisions |
| 270 | +- [ ] Create contribution guidelines |
| 271 | +- [ ] Add design rationale documents |
| 272 | +- [ ] Provide extending/modifying guide |
| 273 | + |
| 274 | +### Story 6.3: Community Engagement |
| 275 | +- [ ] Regular updates to issue #109119 |
| 276 | +- [ ] Engage with LLVM community for feedback |
| 277 | +- [ ] Present at LLVM conferences |
| 278 | +- [ ] Coordinate with Flang team |
| 279 | + |
| 280 | +--- |
| 281 | + |
| 282 | +## Definition of Done |
| 283 | + |
| 284 | +For each story to be considered complete: |
| 285 | + |
| 286 | +### Code Quality |
| 287 | +- [ ] All tests pass (unit + integration) |
| 288 | +- [ ] Code review approved |
| 289 | +- [ ] Performance impact assessed |
| 290 | +- [ ] Memory leak testing passed |
| 291 | + |
| 292 | +### Testing |
| 293 | +- [ ] Red-Green-Refactor cycle completed |
| 294 | +- [ ] Test coverage > 80% for new code |
| 295 | +- [ ] Tests work with gfortran and flang |
| 296 | +- [ ] Edge cases covered |
| 297 | + |
| 298 | +### Documentation |
| 299 | +- [ ] Code properly commented |
| 300 | +- [ ] User-facing features documented |
| 301 | +- [ ] Design decisions recorded |
| 302 | +- [ ] Known limitations noted |
| 303 | + |
| 304 | +### Integration |
| 305 | +- [ ] CI tests pass |
| 306 | +- [ ] No regressions in existing functionality |
| 307 | +- [ ] Follows LLVM coding standards |
| 308 | +- [ ] Ready for upstream submission |
| 309 | + |
| 310 | +--- |
| 311 | + |
| 312 | +## Risk Register |
| 313 | + |
| 314 | +### High-Risk Items |
| 315 | +- **Performance Impact**: Adding language support could slow LLDB |
| 316 | + - *Mitigation*: Profile carefully, implement lazy loading |
| 317 | +- **Compiler Compatibility**: gfortran vs flang differences |
| 318 | + - *Mitigation*: Test with both, abstract differences |
| 319 | +- **DWARF Complexity**: Fortran DWARF can be complex |
| 320 | + - *Mitigation*: Start simple, add complexity incrementally |
| 321 | + |
| 322 | +### Medium-Risk Items |
| 323 | +- **Community Acceptance**: Changes may be rejected upstream |
| 324 | + - *Mitigation*: Engage early, follow guidelines strictly |
| 325 | +- **Maintenance Burden**: Large codebase changes |
| 326 | + - *Mitigation*: Focus on clean, maintainable code |
| 327 | + |
| 328 | +### Low-Risk Items |
| 329 | +- **Build System Changes**: CMake modifications needed |
| 330 | + - *Mitigation*: Follow existing patterns |
| 331 | + |
| 332 | +--- |
| 333 | + |
| 334 | +## Sprint Planning |
| 335 | + |
| 336 | +### Sprint 1 (2 weeks): Environment Setup |
| 337 | +- Epic 1 complete |
| 338 | +- Story 2.1 started |
| 339 | + |
| 340 | +### Sprint 2 (2 weeks): MVP Foundation |
| 341 | +- Stories 2.1-2.2 complete |
| 342 | +- Story 2.3 started |
| 343 | + |
| 344 | +### Sprint 3 (2 weeks): MVP Complete |
| 345 | +- Story 2.3 complete |
| 346 | +- Story 3.1 started |
| 347 | + |
| 348 | +### Sprint 4-6 (6 weeks): Type System |
| 349 | +- Epic 3 complete |
| 350 | + |
| 351 | +### Sprint 7-9 (6 weeks): Expression Evaluation |
| 352 | +- Epic 4 complete |
| 353 | + |
| 354 | +### Sprint 10+ (ongoing): Advanced Features |
| 355 | +- Epic 5 progressive implementation |
| 356 | + |
| 357 | +This backlog provides a clear roadmap following TDD principles while ensuring systematic progress toward full Fortran support in LLDB. |
0 commit comments