locopati

locopati

I was using the Erlang trace debugger to see how my string parsing code was being called. The strings are Unicode and so the output was like this…

(<0.101.0>) returned from ‘Elixir.Tinker’:handle/2 → [<<226,191,178>>,
[<<230,173,162>>,
<<232,135,170>>,
<<229,183,179>>,
<<229,133,171>>,
<<229,164,130>>]]

I ran iex --werl but that didn’t affect the debug output. Is it possible to make the Erlang debugger output Unicode strings so that they’re readable, rather than as bitstrings?

thanks

Showing Posts 1 to 5

NobbZ

NobbZ

How do you debug?

Simply copy pasting this into my shell gives me proper inspection:

 % iex
Erlang/OTP 21 [erts-10.0.8] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>  [<<226,191,178>>,
...(1)> [<<230,173,162>>,
...(1)> <<232,135,170>>,
...(1)> <<229,183,179>>,
...(1)> <<229,133,171>>,
...(1)> <<229,164,130>>]]
["⿲", ["止", "自", "巳", "八", "夂"]]

So it may depend on which part of the program generates the message.

locopati

locopati OP

Unicode characters and strings do appear in the shell. It’s the output during tracing, where everything displays as bitstrings. Since I’m debugging consuming Unicode strings recursively, it’d be helpful if those bitstrings displayed as Unicode characters.

josevalim

josevalim

Creator of Elixir

Which debugging are you using? :dbg? :sys? Note they usually allow you to pass a handler, so you can pass your own handler instead of relying on the default one.

locopati

locopati OP

I used :dbg. Thanks for the pointer to handlers. I’ll look into that.

josevalim

josevalim

Creator of Elixir

The Adopting Elixir book has a chapter on production tools and a section on :dbg, here is the example we use:

iex> fun = fn _, 100 -> :dbg.stop_clear(); msg, n -> IO.inspect(msg) && n + 1 end
iex> :dbg.tracer(:process, {fun, 0})
— All posts loaded —

Where Next? Top

Trending in Questions Top

itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
saleyn
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews