Skip to content

Commit

Permalink
Add some debug logging
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <sean@mess.org>
  • Loading branch information
seanyoung committed May 11, 2024
1 parent 3b7e4e7 commit 1f7a71c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cir/src/bin/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,12 @@ fn load_keymap(
}
}

log::debug!(
"attaching bpf program for {} to {}",
keymap_filename.display(),
chdev
);

if let Err(e) = chdev.attach_bpf(&bpf) {
eprintln!("error: {}: attach bpf: {e}", keymap_filename.display());
std::process::exit(1);
Expand Down Expand Up @@ -600,6 +606,8 @@ fn load_lircd(
std::process::exit(1);
}

log::debug!("attaching bpf program for {} to {}", remote.name, chdev);

for code in remote.codes {
let mut name = code.name.to_uppercase();
if !name.starts_with("KEY_") {
Expand Down
4 changes: 4 additions & 0 deletions irp/src/build_bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ impl DFA {
log::info!("saving llvm ir as {filename}");

builder.module.print_to_file(&filename).unwrap();
} else {
log::debug!("generated llvm ir for {}", options.name);
}

builder.module.verify().unwrap();
Expand Down Expand Up @@ -115,6 +117,8 @@ impl DFA {
};

file.write_all(slice).unwrap();
} else {
log::debug!("generated object file for {}", options.name);
}

let mut vars = vec![String::new(); builder.vars.len()];
Expand Down
6 changes: 5 additions & 1 deletion irp/src/build_dfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::{
expression::clone_filter,
Expression, Irp, Options,
};
use log::info;
use log::{debug, info};
use std::{
collections::{HashMap, HashSet},
hash::Hash,
Expand Down Expand Up @@ -55,12 +55,16 @@ impl NFA {
let filename = options.filename("_nfa.dot");
info!("saving NFA as {filename}");
self.dotgraphviz(&filename);
} else {
debug!("generated NFA for {}", options.name);
}

if options.dfa {
let filename = options.filename("_dfa.dot");
info!("saving DFA as {filename}");
dfa.dotgraphviz(&filename);
} else {
debug!("generated DFA for {}", options.name);
}

dfa
Expand Down

0 comments on commit 1f7a71c

Please sign in to comment.