Find out all files which are 'source' the given tcl file - grep

Is it possible to find out all files which are sources the given .tcl files?

Your best options are to either replace source or add a trace for source
example with trace:
proc putargs args {puts $args}
trace add execution enter source {putargs SOURCE}
source /path/to/your/file.tcl

Related

How to get workspace directory in bazelrc

I want to specify a ASAN suppression file in .bazelrc. And the suppression file is located in workspace directory. I tried as following:
build:debug --action_env=LSAN_OPTIONS=suppressions=${workspace}/asan_leaks.supp
and
build:debug --action_env=LSAN_OPTIONS=suppressions=%workspace%/asan_leaks.supp
But what I got is:
AddressSanitizer: failed to read suppressions file
'/projects/mytest/bazel-output/execroot/mytest/bazel-out/aarch64-dbg/bin/mytest/${workspace}/asan_leaks.supp'
and
AddressSanitizer: failed to read suppressions file
'/projects/mytest/bazel-output/execroot/mytest/bazel-out/aarch64-dbg/bin/mytest/%workspace%/asan_leaks.supp'
It works if I hardcoded an absolute path, so I try to get the absolute path of workspace. Any suggestions are welcome, thanks.
Just update my workaround in case that somebody encouter similar issue:
Hardcode the suppression file with absolute path as following:
build:debug --action_env=suppressions=/tmp/asan_leaks.supp
Specify workspace_status_command relative to workspace directory
build --workspace_status_command=./bazel/cmd.sh
Make soft link to the suppression file in cmd.sh
bazel_dir=$(dirname -- "$(readlink -f $0;)")
ln -sf ${bazel_dir}/asan_leaks.supp /tmp/asan_leaks.supp

`bazel query ./main.cpp --output=location` does not return `~/project/package/BUILD:lnum:column` format

In Bazel 4.2.2 I could do a "go-to-reference" on a source file to get the path of the corresponding BUILD file, along with the line and column numbers pointing to where the source file is referenced:
bazel query ./main.cpp --output=location
~/project/package/BUILD:124:8: source file //package:main.cpp
In Bazel 5.1.1 this command returns the path of the very same source file:
bazel query ./main.cpp --output=location
~/project/package/main.cpp:1:1: source file //package:main.cpp
How to get the old behavior back?
P.S. This ticket requests the new behavior.
Solution is to use --noincompatible_display_source_file_location:
bazel query ./main.cpp --output=location --noincompatible_display_source_file_location
~/project/package/BUILD:124:8: source file //package:main.cpp

Inkscape can't find the file for includesvg

Having a nightmare including an svg file in my document. It's just a picture of Tux.
Code:
\svgpath{{C:/Users/me/Google\ Drive/foo}}
\includesvg[width = 200pt]{tux}
Error:
** (inkscape.exe:27228): WARNING **: 20:52:43.840: Can't open file: tux.svg (doesn't exist)
** (inkscape.exe:27228): WARNING **: 20:52:43.840: Can't open file: tux.svg (doesn't exist)
** (inkscape.exe:27228): WARNING **: 20:52:43.840: Specified document tux.svg cannot be opened (does not exist or not a valid SVG file)
The system cannot find the file specified.
The system cannot find the file specified.
I wish it would give me more debugging information so I could tell what directory is being used. I've enabled --shell-escape. I've tried various combinations with no success.
EDIT: Minimal example
\documentclass{article}
\usepackage{svg}
\begin{document}
\includesvg{tux}
\end{document}
I created a directory c:\latex
My command line is texify --pdf --engine=luatex --synctex=1 --tex-option=--shell-escape --clean foo
I noticed that it also says there's a log file, but I cannot find a log file with more information
Package svg Warning: The export with Inkscape failed for file
(svg) `tux.svg'
(svg) Troubleshooting: Please check in the log file how
(svg) the invocation of Inkscape took place and try to
(svg) execute it yourself in the terminal on input line 5.
I would love to get my hands on that mythical log file. There's a foo.log file but that just says what my console output was. There's another log file at C:\Users\james\AppData\Local\MiKTeX\2.9\miktex\log\texify.log, but that doesn't have any information about the inkscape command either.
The docs (http://mirror.its.dal.ca/ctan/graphics/svg/doc/svg.pdf) say that I should see runsystem ....
The problem is the --clean option. I figured this out by selected pdflatex in TeXWorks and it suddenly built. Taking out options one by one helped me get to the bottom of this. Going back to post on some other questions.
As #samcarter pointed out, if you don't have to use texify, try not to. One of my packages requires LuaLaTex to typeset, so I selected the LuaLaTeX +MakeIndex +BibTex when I only needed the LuaLaTex plain option. Using that one fixed the issue.
If you have to use texify, though, try removing the --clean.

Command 'rebar doc' is inconsistent

First of all, 'rebar doc' works sometimes and sometimes not. It is strange.
Rebar version which I'm using is 2.5.1
My folder structure is:
Header_Directory
1.1 apps
1.1.1 sub_dir_1
1.1.2 sub_dir_2 / include
1.1.3 sub_dir_3
1.2 deps
1.3 confs
rebar.config
Modules in sub_dir_3 also use some include files from sub_dir_2/include folder.
The error I get when I use the command rebar doc is:
.sub_dir_3/src/my_log_worker.erl, in module header: at line 9: file
not found: some.hrl edoc: skipping source file
'sub_dir_3/src/my_log_worker.erl': {'EXIT',error}. edoc: error in
doclet 'edoc_doclet': {'EXIT',error}. ERROR: doc failed while
processing /home/learn/header_directory/apps/sub_dir_3: {'EXIT',error}
I do 'rebar clean' and then 'rebar compile' prior to 'rebar doc'
Also,when I do it in erl shell, I get error.
edoc:file("some_log_worker.erl", []).
edoc: error reading file 'some_log_worker.erl'.
** exception exit: {error,enoent}
in function edoc:read_source/2 (edoc.erl, line 664)
in call from edoc_extract:source/3 (edoc_extract.erl, line 52)
in call from edoc:read/2 (edoc.erl, line 537)
in call from edoc:file/2 (edoc.erl, line 116)
Is there any way by which I can include my hrl file either in rebar.config or edoc options?
I have '{edoc_opts, [{ i, "apps/sub_dir_3/include" }]}.' in rebar.config, still of no help.
It looks like you didn't follow the rebar/OTP conventions:
OTP Conventions
Rebar expects projects to follow the OTP conventions as described in
the OTP Design Principles document: Applications
An application should consists of the following set of directories:
src
ebin
priv
include
and have an application resource file: ebin/example_project.app or
src/example_project.app.src. In the later case, the
ebin/example_project.app file is generated from the
src/example_project.app.src one automatically during the compilation
phase.
Rebar & OTP convetions
I recommend you to move to that file organisation, it will be really much simpler to benefit from standard tools like rebar.
Yes, it is always in the best interest to follow the OTP principles. However, it worked for my app structure.
The only problem was because of #headerfile annotation in the erlang modules. Somehow, I don't know how to correctly use the #headerfile annotation.
Thanks for all the help. :)

Need help after instrumenting the jar in EMMA

I am new to Code Coverage and EMMA tool.
I am trying to:
1. Write a simple java program "testClass1.java". Compile it, and a got a "testClass1.class" file.
2. I package this as a jar. "myJar.jar"
3. Instrument this jar using this emma command and got a coverage.em file
C:\Users\emahaboo\Desktop>java -cp emma-2.0.5312.jar emma instr -m overwrite -cp myJar.jar
EMMA: processing instrumentation path ...
EMMA: instrumentation path processed in 156 ms
EMMA: [1 class(es) instrumented, 0 resource(s) copied]
EMMA: metadata merged into [C:\Users\emahaboo\Desktop\coverage.em] {in 7 ms}he emma command.
Now I want to execute this "myJar.jar" file.
I am not sure, what should I do exactly here, because I get the below error:
C:\Users\emahaboo\Desktop>java -cp myJar.jar:emma-2.0.5312.jar myJar
Error: Could not find or load main class myJar
C:\Users\emahaboo\Desktop>java -cp myJar.jar:emma-2.0.5312.jar testClass1
Error: Could not find or load main class testClass1
Can someone help me to proceed. I want to successfully run this program and get the emma code coverage report.
On Windows, items on the classpath need to be separated with semicolons. I would put the whole parameter in quotes:
-cp "myJar.jar;emma-2.0.5312.jar"
If you want to execute a jar file, there must be a main class as the entrance. For the error "Error: Could not find or load main class...", it just means that it can't find the main class. I think the root cause for this is due to your second step: "I package this as a jar. "myJar.jar"". when you packaged it, you need to set the testClass1 as the main class for this jar file. Hope this helps.

Resources