# Why are \`code\_llvm\` and \`code\_native\` not displayed in color?

**URL:** https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959
**Category:** New to Julia
**Created:** [July 12, 2020, 7:30pm UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959 "2020-07-12T19:30:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kimikage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kimikage/32/14534_2.png) [@kimikage](https://discourse.julialang.org/u/kimikage)
#### Post date: [July 12, 2020, 7:30pm UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/1 "2020-07-12T19:30:09Z")

</div>

I love `code_native`, but I don’t like `code_llvm` very much. The reason is that the output of `code_llvm` is very hard to read.

I want the result like the image below. Are there any options or packages to make the printing colorful?

 ![code_llvm](https://global.discourse-cdn.com/julialang/original/3X/4/e/4e7eb4b56374c335fe6a12dc7ec8021e28584674.png)

I found that I needed the script with ~150 lines and didn’t need any additional packages other than `InteractiveUtils` to show the screen above.

**Edit:**  
I reported an issue [Colored printing of `code_llvm` and `code_native` · Issue #36634 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/36634)

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [July 12, 2020, 7:38pm UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/2 "2020-07-12T19:38:42Z")

</div>

Make a PR to Julia! Stacktraces in 1.5 or 1.6 (I forget) are colored and much better because someone wrote a little code to make them prettier. It was a really active pr with about 40 different visual tweeks until everyone was happy, but the result was great!

---

<div class="post-metadata">

### Author: ![Ellipse0934](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellipse0934/32/4012_2.png) [@Ellipse0934](https://discourse.julialang.org/u/Ellipse0934)
#### Post date: [July 12, 2020, 8:17pm UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/3 "2020-07-12T20:17:33Z")

</div>

Here’s the issue which Oscar is referencing: [https://github.com/JuliaLang/julia/issues/36026](https://github.com/JuliaLang/julia/issues/36026) . I didn’t think people would’ve wanted this in Base and maybe something like OhMyREPL.jl is better suited to have such features. Definitely open an issue and discuss it. I would love something like this.

EDIT: Here’s the PR [https://github.com/JuliaLang/julia/pull/36134](https://github.com/JuliaLang/julia/pull/36134)

---

<div class="post-metadata">

### Author: ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)
#### Post date: [July 12, 2020, 8:33pm UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/4 "2020-07-12T20:33:54Z")

</div>

FYI [https://github.com/tkf/ColorfulCodeGen.jl](https://github.com/tkf/ColorfulCodeGen.jl) has `@ccode_llvm`, `@ccode_native`, `@cshow_sexpr`, etc.

---

<div class="post-metadata">

### Author: ![kimikage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kimikage/32/14534_2.png) [@kimikage](https://discourse.julialang.org/u/kimikage)
#### Post date: [July 13, 2020, 12:38am UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/5 "2020-07-13T00:38:39Z")

</div>

Thank you for your comments.  
I reported an issue [https://github.com/JuliaLang/julia/issues/36634](https://github.com/JuliaLang/julia/issues/36634).

---

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [July 13, 2020, 2:03am UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/6 "2020-07-13T02:03:27Z")

</div>

I strongly recommend [Cthulhu.jl](https://github.com/JuliaDebug/Cthulhu.jl).  
It displays with color / syntax highlighting, and also lets you descend into Julia functions called by the one you’re looking at.

```julia
@noinline bar(x) = 3x
foo(x) = sqrt(3bar(x))
@descend foo(5)

```

Now I can press `N` for native code, `L` for llvm, `w` for code-typed, `d` to toggle debuginfo, etc.

Additionally, it shows a menu of functions to descend into:

```julia
 • %1 = invoke bar(::Int64)::Int64
   %6 = invoke throw_complex_domainerror(::Symbol,::Float64)::Union{}

```

You can select one and press enter to descend into it, and explore its code-typed/llvm/native, as well as any other functions it may be calling.

I’ve added it to my `startup.jl`, and use `@descend` a lot more often than any of `@code_*`s.  
I’ve also set:

```julia
Cthulhu.CONFIG.asm_syntax = :intel

```

Which makes Intel the default syntax for asm. I prefer Intel syntax for 2 primary reasons:

1. Addressing calculations are much clearer.
2. Instructions assign/update the first argument, which is the same as Julia’s convention.

---

<div class="post-metadata">

### Author: ![kimikage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kimikage/32/14534_2.png) [@kimikage](https://discourse.julialang.org/u/kimikage)
#### Post date: [July 13, 2020, 4:50am UTC](https://discourse.julialang.org/t/why-are-code-llvm-and-code-native-not-displayed-in-color/42959/7 "2020-07-13T04:50:17Z")

</div>

The heuristic highlighting algorithm I wrote works on line-by-line basis and doesn’t (cannot) deal with the global structure or backtracking. For this reason, we have an option of creating a separate package which is independent of Cthulhu and using its low-level API in Cthulhu.

BTW, I also prefer the Intel syntax. 😄
