Skip to content

make: update stack-analysis format#2712

Merged
bors[bot] merged 2 commits into
masterfrom
stack-analysis-format
Aug 11, 2021
Merged

make: update stack-analysis format#2712
bors[bot] merged 2 commits into
masterfrom
stack-analysis-format

Conversation

@bradjc

@bradjc bradjc commented Jul 30, 2021

Copy link
Copy Markdown
Contributor

Pull Request Overview

Two things:

  1. Makes the make allstack easier to read:
$ make stack-analysis
imix
----------------------
   main stack frame:
         2048     main

   5 largest stack frames:
         2048     main
          720     _ZN104_$LT$capsules..process_console..ProcessConsole$LT$C$GT$$u20$as$u20$kernel..hil..uart..TransmitClient$GT$18transmitted_buffer17h4c3fef6f6a95d58fE
          632     _ZN8capsules15process_console23ProcessConsole$LT$C$GT$11write_state17hee14a9c17699800aE
          608     _ZN7cortexm24kernel_hardfault_arm_v7m17h8c7b48b27a33c005E
          600     _ZN98_$LT$capsules..ieee802154..framer..Framer$LT$M$C$A$GT$$u20$as$u20$kernel..hil..radio..RxClient$GT$7receive17h8a8322dd16823f26E

   **WARNING! main is the largest stack frame!**
  1. Enables make stack-analysis V=1 to work fully.

Testing Strategy

Running make stack-analysis.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

Comment thread tools/stack_analysis.sh
printf "main stack frame: \n"
$(find $(rustc --print sysroot) -name llvm-readobj) --elf-output-style GNU --stack-sizes $1 | grep 'main'
bold=$(tput bold)
normal=$(tput sgr0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads-up this adds a dependency on ncurses. It's shipped with my distro and seems to be on many, but it's worth keeping in mind - for instance I'm not quite sure whether Cygwin would have it by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've had tput around in the tools and build system for a long time; not a new dependency here, so I think it's fine.

lschuermann
lschuermann previously approved these changes Jul 30, 2021

@lschuermann lschuermann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool.

@lschuermann lschuermann added the P-Upkeep This a relatively minor change, or one that is limited in scope, and requires less scrutiny. label Jul 30, 2021
ppannuto
ppannuto previously approved these changes Jul 30, 2021
Comment thread tools/stack_analysis.sh
hudson-ayers
hudson-ayers previously approved these changes Jul 30, 2021
@phil-levis

Copy link
Copy Markdown
Contributor

We need to be more careful and cautious about changing the output of tools. It can be that other tools depend on their output, such that changing it breaks those tools. This is an example of a churn/incremental improvement change which can be frustrating to people downstream.

alistair23
alistair23 previously approved these changes Aug 1, 2021
@bradjc

bradjc commented Aug 2, 2021

Copy link
Copy Markdown
Contributor Author

This tool has only existed for 138 days. Are you aware of any downstream scripts that process the output?

Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com>
@hudson-ayers

Copy link
Copy Markdown
Contributor

I am not aware of anyone processing the output of this script downstream, and downstream users are welcome to vendor a copy of the old version if they want the old output format. I do not think that every tool committed to the Tock repository should be locked into its original format, when I published this originally it was just a quick way to let others experiment with solutions to our stack size woes.

@bradjc

bradjc commented Aug 10, 2021

Copy link
Copy Markdown
Contributor Author

ping

@ppannuto

Copy link
Copy Markdown
Member

bors r+

Phil's point about output stability is well-taken, particularly for things that are 'promoted' (i.e. this isn't just a script in the tools/ directory, it's advertised via the primary make interface). That said, I think the argument that this is a very new tool still figuring out its interface and output holds here. However, that becomes less true after this is bundled as a new make-accessible tool with 2.0.

@bors

bors Bot commented Aug 10, 2021

Copy link
Copy Markdown
Contributor

Build failed (retrying...):

@bors

bors Bot commented Aug 10, 2021

Copy link
Copy Markdown
Contributor

Build failed:

@hudson-ayers

Copy link
Copy Markdown
Contributor

bors retry

@bors

bors Bot commented Aug 11, 2021

Copy link
Copy Markdown
Contributor

@bors bors Bot merged commit 5e8c37a into master Aug 11, 2021
@bors bors Bot deleted the stack-analysis-format branch August 11, 2021 02:34
sirchnik pushed a commit to sirchnik/tock that referenced this pull request May 12, 2026
2712: make: update stack-analysis format r=ppannuto a=bradjc

### Pull Request Overview

Two things:

1. Makes the `make allstack` easier to read:

```
$ make stack-analysis
imix
----------------------
   main stack frame:
         2048     main

   5 largest stack frames:
         2048     main
          720     _ZN104_$LT$capsules..process_console..ProcessConsole$LT$C$GT$$u20$as$u20$kernel..hil..uart..TransmitClient$GT$18transmitted_buffer17h4c3fef6f6a95d58fE
          632     _ZN8capsules15process_console23ProcessConsole$LT$C$GT$11write_state17hee14a9c17699800aE
          608     _ZN7cortexm24kernel_hardfault_arm_v7m17h8c7b48b27a33c005E
          600     _ZN98_$LT$capsules..ieee802154..framer..Framer$LT$M$C$A$GT$$u20$as$u20$kernel..hil..radio..RxClient$GT$7receive17h8a8322dd16823f26E

   **WARNING! main is the largest stack frame!**
```

2. Enables `make stack-analysis V=1` to work fully.


### Testing Strategy

Running `make stack-analysis`.


### TODO or Help Wanted

n/a


### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [x] Ran `make prepush`.


Co-authored-by: Brad Campbell <bradjc5@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P-Upkeep This a relatively minor change, or one that is limited in scope, and requires less scrutiny.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants