Somewhere in a mass of code that I did not write (but I am trying to debug), an assertion fails in the GLib library:
(process:31987): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed
However, GDB and the code keeps on going. I would like GDB to break where this assertion fails so that I can find out why it is failing. I am not given any more information about where this assertion is. Is there a way to get GDB to break on such a failure?
You should add an environment variable like this:
G_DEBUG=fatal_warnings gdb ...
Break on g_log(). This covers all cases like g_warning(), g_critical(), etc.
Related
I am trying to figure out why configure step for Qt6.4 on MacOS fails.
As investigating logs and googling leads nowhere I started to debug underlying cmake.
Now I am in function that looks like:
function(qt_evaluate_to_boolean expressionVar)
if(${${expressionVar}})
set(${expressionVar} ON PARENT_SCOPE)
else()
set(${expressionVar} OFF PARENT_SCOPE)
endif()
endfunction()
Where expressionVar is TEST_openssl_headers.
The result of this operation is FALSE. I need to know why.
In the logs there is no TEST_openssl_headers, so apparently the test compilation is not even called.
Why? How can I know what happens at the "if" line? Where it calls? How does it evaluate if it is true?
I rewrite a program and just removed a lot of code, by just making it a comment. After doing that and adding some tests, it is impossible to run the program anymore.
when running go build it has no errors at all.
But when running go test i only become some weird output:
$ go test
2020/05/05 19:14:24 open : no such file or directory
exit status 1
FAIL fwew_lib 0.002s
This error occurs, before a single test is even run, so within the test framework itself.
Why is there is no file specified that is not found? Any idea, what caused this error and how to fix it?
This error also occurred on multiple machines with windows and linux. And with go 1.14.2 and go 1.13.7.
To get this error yourself:
Repo: https://github.com/knoxfighter/fwew/tree/library
Branch: library
Just download the branch and run go test
Your fork is missing this line from the parent
texts["dictionary"] = filepath.Join(texts["dataDir"], "dictionary.txt")
link
But your fork still has this line which depends on the one mentioned above
Version.DictBuild = SHA1Hash(texts["dictionary"])
link
And so the SHA1Hash "fatals" out since you're essentially passing it an empty string.
link
We use docker and so the source code is for linux code. However, we develop on Macs, and as a result go-guru-callers fails to work when run locally.
It complains with the error below but the error is because that property is linux specific:
/Users/uri/Documents/connect/src/connect/job/native.go:104:4: unknown field Pdeathsig in struct literal
and the code:
cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: syscall.SIGKILL,
}
Any workarounds?
You can use build conditions to specify what code should be built on what OS and architecture, in order to separate out code that is platform-specific and avoid these kinds of compilation failures. See the go build documentation here.
I have been following this tutorial for reference:
http://valgrind.org/docs/manual/ms-manual.html
When I am using it to profile my Application Using the command:
valgrind --tool=massif --time-unit=B ./run.o
It finishes but does not produce any output file.
Here is the log while running it using the mentioned command.
https://www.dropbox.com/s/yae78rm9wmdbph1/ValGring_massif_Log?dl=0
Kindly suggest why it won't produce a massif.out.xxxxx file ?
If you look in your log file you will see that Valgrind has
crashed, and it explains why, and what you should do to fix it.
valgrind: m_mallocfree.c:304 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 91849568, hi = 1425748016.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata. If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away. Please try that before reporting this as a bug.
Use Valgrind's memcheck to fix
your program and try again.
I'm new to golang. I was debugging my go application.
While I tried to run "info goroutines", it threw out:
Undefined info command: "goroutines".
Try "help info
What did I miss in my gdb configuration?
The article "Debugging Go Code with GDB" does mention:
(gdb) info goroutines
But only in the context of loading extension scripts for a given binary.
The tool chain uses this to extend GDB with a handful of commands to inspect internals of the runtime code (such as goroutines) and to pretty print the built-in map, slice and channel types.
If you'd like to see how this works, or want to extend it, take a look at src/pkg/runtime/runtime-gdb.py in the Go source distribution.
It depends on some special magic types (hash<T,U>) and variables (runtime.m and runtime.g) that the linker (src/cmd/ld/dwarf.c) ensures are described in the DWARF code.
If you're interested in what the debugging information looks like, run 'objdump -W 6.out' and browse through the .debug_* sections.
So make sure your debug session is run with those extensions activated.
in the gdb session run
source $GOROOT/src/runtime/runtime-gdb.py
where $GOROOT is go lives (see go env | grep ROOT)
you should use https://github.com/go-delve/delve as recommended by golang docs https://golang.org/doc/gdb