Praqma / memory-map-plugin

A repository for the memory-map-plugin
13 stars 16 forks source link

NullPointerException #55

Open karlp opened 4 years ago

karlp commented 4 years ago

Unfortunately there's no stack trace, just...

Memory Map Plugin version 2.2.1 (53614)
ERROR: Build step failed with exception
java.lang.NullPointerException
Build step 'Memory Map Publisher' marked build as failure

I added a custom logger for net.praqma.jenkins and got nothing extra there either.

I suspect that the linker script parsing doesn't handle includes? The linker script is just

/* Define memory regions. */
MEMORY
{
    rom (rx) : ORIGIN = 0x08002000, LENGTH = 56K
    ram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
    eep (r) : ORIGIN = 0x08080000, LENGTH = 4K
}

INCLUDE ../common/cortex-m-generic.ld

However, I don't know how to debug this further

praqma-thi commented 4 years ago

Can you share the Memory Map plugin's configuration of your job? I'll see if I can reproduce the issue.

karlp commented 4 years ago

Reconfigured it from scratch again, and got a stack trace thsi time too...

Memory Map Plugin version 2.2.1 (53614)
ERROR: Build step failed with exception
java.lang.NullPointerException
    at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
    at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
    at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
    at java.base/java.util.regex.Pattern.matcher(Pattern.java:1133)
    at net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser.getSections(GccMemoryMapParser.java:110)
    at net.praqma.jenkins.memorymap.parser.gcc.GccMemoryMapParser.parseConfigFile(GccMemoryMapParser.java:185)
    at net.praqma.jenkins.memorymap.parser.MemoryMapConfigFileParserDelegate.invoke(MemoryMapConfigFileParserDelegate.java:58)
    at net.praqma.jenkins.memorymap.parser.MemoryMapConfigFileParserDelegate.invoke(MemoryMapConfigFileParserDelegate.java:41)
    at hudson.FilePath.act(FilePath.java:1075)
    at hudson.FilePath.act(FilePath.java:1058)
    at net.praqma.jenkins.memorymap.MemoryMapRecorder.perform(MemoryMapRecorder.java:89)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.post2(Build.java:186)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
    at hudson.model.Run.execute(Run.java:1905)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:428)
Build step 'Memory Map Publisher' marked build as failure

COnfig is as per image, based on examples in https://github.com/Praqma/memory-map-examples/blob/master/examples/arm-none-eabi-gcc_4.8.4_hello_world/graphConfiguration.json Screenshot from 2020-08-12 09-34-30

app.ld is (with comments stripped)

{
    rom (rx) : ORIGIN = 0x08002000, LENGTH = 56K
    ram (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
    eep (r) : ORIGIN = 0x08080000, LENGTH = 4K
}
INCLUDE ../common/cortex-m-generic.ld

cortex-m-generic.ld is https://github.com/libopencm3/libopencm3/blob/master/lib/cortex-m-generic.ld

praqma-thi commented 4 years ago

The parser tries to find the SECTIONS block it assumes is in your app.ld. The following step then happily explodes trying to parse null. So indeed, it boils down to the plugin being unable to handle INCLUDE statements. In the end, it's just a humble jumble of regular expressions.

I'll make an issue about the missing INCLUDE support, though that might take a while to implement. Our Jenkins plugins are mostly on life support as our R&D has all but evaporated. In the mean time, you'll probably need find a workaround, such as appending the files together in an earlier step.