diff --git a/scripts/codemap.py b/scripts/codemap.py index 99f5e120..1c367717 100755 --- a/scripts/codemap.py +++ b/scripts/codemap.py @@ -1019,6 +1019,8 @@ def main_(f, paths, *, # merge code/stack/ctx results functions = co.OrderedDict() for r in results: + if 'function' not in r: + continue if r['function'] not in functions: functions[r['function']] = {'name': r['function']} # code things @@ -1155,6 +1157,10 @@ def main_(f, paths, *, # assign colors/chars/labels to code tiles for i, t in enumerate(code.leaves()): + # skip the top tile, yes this can happen if we have no code + if t.depth == 0: + continue + t.color = subsystems[t.attrs['subsystem']]['color'] if (i, t.attrs['name']) in chars_: @@ -1218,6 +1224,11 @@ def main_(f, paths, *, ((total_value * to_scale) / (width_*xscale)) / yscale) + # as a special case, if height is implicit and we have nothing to + # show, don't print anything + if height is None and nil_code and nil_frames and nil_ctx: + height_ = 1 if not no_header else 0 + # our general purpose partition function def partition(tile, **args): if tile.depth == 0: diff --git a/scripts/codemapd3.py b/scripts/codemapd3.py index e4149290..0bf20adc 100755 --- a/scripts/codemapd3.py +++ b/scripts/codemapd3.py @@ -750,6 +750,8 @@ def main(paths, output, *, # merge code/stack/ctx results functions = co.OrderedDict() for r in results: + if 'function' not in r: + continue if r['function'] not in functions: functions[r['function']] = {'name': r['function']} # code things @@ -886,7 +888,12 @@ def main(paths, output, *, # assign colors/labels to code tiles for i, t in enumerate(code.leaves()): + # skip the top tile, yes this can happen if we have no code + if t.depth == 0: + continue + t.color = subsystems[t.attrs['subsystem']]['color'] + if (i, t.attrs['name']) in labels_: label__ = labels_[i, t.attrs['name']] # don't punescape unless we have to @@ -1221,6 +1228,9 @@ def main(paths, output, *, # create code tiles for i, t in enumerate(code.leaves()): + # skip the top tile, yes this can happen if we have no code + if t.depth == 0: + continue # skip anything with zero weight/height after aligning things if t.width == 0 or t.height == 0: continue diff --git a/scripts/treemap.py b/scripts/treemap.py index 39c3a02d..054dc1aa 100755 --- a/scripts/treemap.py +++ b/scripts/treemap.py @@ -1090,6 +1090,11 @@ def main_(f, csv_paths, *, ((tile.value * to_scale) / (width_*xscale)) / yscale) + # as a special case, if height is implicit and we have nothing to + # show, don't print anything + if height is None and tile.value == 0: + height_ = 1 if not no_header else 0 + # create a canvas canvas = Canvas( width_,