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

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
subsaharancoder
I’ve followed the Phoenix LiveView file upload code here Uploads — Phoenix LiveView v1.0.0-rc.7 and so far everything works just fine wit...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews