GOlang core dump analysis using delve throws error 'unrecognized core format' - go

Iam trying to analyse core file of GO program generated by gcore using delve. Below are steps I have followed. I got Unrecognized format error
$go version
go version go1.13.1 darwin/amd64
$/Users/sudhakar/go/bin/dlv version
Delve Debugger
Version: 1.4.0
Build: 37bee98a8821843314b561bc6ab328dfff2aad1b
$./hello &
[1] 72335
$gcore 72335
$sudo gcore 72335
$/Users/sudhakar/go/bin/dlv core ./hello /cores/hello-72335-20200427T185443Z
unrecognized core format

At the time of this post darwin/amd64 is not supported by delve.
Ref: https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_core.md
However this can change over time (delve may add support to this arch) attaching screenshot of documentation (at the time of this post)
Special thanks to delve-dev list member (Choudhary Sourya Vastayan) who pointed me to this.

Related

What is the message when it is building on Golang?

When I build source on Golang, I saw the warning message, but I couldn't find answer about it.
$ go build --mod=mod -o main main.go
# command-line-arguments
ld: warning: -no_pie is deprecated when targeting new OS versions
specs
version : go version go1.18 darwin/amd64
os : Monterey 12.6
build command : go build --mod=mod -o [binary name] main.go
From GitHub: link
There are a few options:
- wait for the next Go 1.19.x and 1.18.x releases, probably early next month
- build Go from the master branch
- pass -buildmode=pie flag to go build and go test for a workaround
- use older version of the system linker
This seems to be a known issue. See Github for more information.
As a workaround you can pass the -buildmode=pie flag to your go build command.

Cannot install gotk3, getting GdkMonitor error

I tried to use gotk3 for creating desktop application. I follow the instruction in gotk3 wiki and this installing-on-linux wiki to install it. But then I get this error while executing go get -v:
gcc errors for preamble:
In file included from ../../gotk3/gotk3/gdk/gdk_since_3_22.go:23:0:
./gdk_since_3_22.go.h:22:8: error: unknown type name 'GdkMonitor'
static GdkMonitor *
^
I've tried to delete the gotk3 directory, and then trying to go get -v again, but still, it didn't work.
I also checked the GTK version that installed in my Ubuntu 16.04 using apt-cache policy libgtk2.0-0 libgtk-3-0 | grep Installed. And it shows this:
Installed: 2.24.30-1ubuntu1.16.04.2
Installed: 3.18.9-1ubuntu3.3
What did I do wrong? Thanks
GdkMonitor was introduced in GTK+ 3.22. Your version is 3.18.
go get -tags gtk_3_18 github.com/gotk3/gotk3/gtk at the very beginning of building (see here NOTE section) should fix things

Unable to debug Go code: could not launch process: decoding dwarf section info at offset 0x0: too short

we are trying to debug Go code and getting this error:
could not launch process: decoding dwarf section info at offset 0x0: too short
our settings:
WITSC02X6385JGH:orderer sjain68$ uname -a
Darwin WITSC02X6385JGH 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul 6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64
WITSC02X6385JGH:orderer sjain68$ go version
go version go1.11 darwin/amd64
WITSC02X6385JGH:orderer sjain68$ dlv version
Delve Debugger
Version: 1.1.0
Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c
Things we have tried:
Update dlv using VS Code -> Go: Install/Update Tools
Try running from command line:
WITSC02X6385JGH:orderer sjain68$ /Users/sjain68/go/bin/dlv debug github.com/hyperledger/fabric/orderer --headless=true --listen=127.0.0.1:41305 --api-version=2 --log=true --
API server listening at: 127.0.0.1:41305
INFO[0002] launching process with args: [/Users/sjain68/go/src/github.com/hyperledger/fabric/orderer/debug] layer=debugger
debugserver-#(#)PROGRAM:debugserver PROJECT:debugserver-902.0.79.7
for x86_64.
Got a connection, launched process /Users/sjain68/go/src/github.com/hyperledger/fabric/orderer/debug (pid = 9278).
Exiting.
could not launch process: decoding dwarf section info at offset 0x0: too short
Note that the binary that we are trying to debug does gets executed. Its just that the debugger does not launch.
Another thing we tried from this link:
WITSC02X6385JGH:orderer sjain68$ export GOFLAGS="-ldflags=-compressdwarf=false"; dlv debug
could not launch process: decoding dwarf section info at offset 0x0: too short
Someone said to run GOCACHE=off go build ... and output of that is pasted here.
How can we fix this?
I had the same issue after updateing Go.
Updating Delve package from console helped:
go get -u github.com/go-delve/delve/cmd/dlv
The solution that worked for us was to upgrade Go version
$ go version
go version go1.13.3 darwin/amd64
So Go 1.11 is the culprit.
make sure you aren't using flags that remove the debug info from your build ie -ldflags="-s -w" .
https://lukeeckley.com/post/useful-go-build-flags/

while executing make of i3-gaps, undefined reference to `g_utf8_make_valid' error

After following all instructions from Compiling and Installing page, I have successfully installed all the packages required. After performing ../configure --prefix=/usr --sysconfdir=/etc --disable-sanitizers, I get
build configured:
i3 version: 4.15.0.1-323-gccb1947 (2018-09-28, branch "gaps-next")
is release version: no
build manpages: no
build docs: no
enable debug flags: yes
code coverage: no
enabled sanitizers:
To compile, run:
cd /home/dharmin/i3-gaps/build && make -j8
Now, when I do make or make -j8, I get the following error
./libi3.a(libi3_a-string.o): In function `i3string_from_utf8_with_length':
/home/dharmin/i3-gaps/build/../../i3-gaps/libi3/string.c:59: undefined reference to `g_utf8_make_valid'
collect2: error: ld returned 1 exit status
On a quick google search, I found only one related reddit link. But that did not help solve the problem.
My current i3 version
Binary i3 version: 4.11 (2015-09-30, branch "4.11") © 2009 Michael Stapelberg and contributors
Linux Distribution & Version: Ubuntu 16.04
Thank you in advance for helping :)
I made a Reddit post mentioning this question. I was having the exact same problem and was tinkering away.
My final solution was to download version 4.13*, which does not make a reference to g_utf8_make_valid. If you have all the dependencies installed, it should compile fine.
* You are running 4.11. Installing 4.13 or something newer, depending on how new the libraries you can get are, might work, but I would try to install 4.11 in your case.

Upstart causes kernel panic on embedded Linux

I am using ptxdist to create kernel and rootfs images for a Linux embedded system, running on an ARM Cortex A8 CPU.
I was trying to use a newer compiler (GCC 5+) and so was forced to upgrade several external packages that would not compile under the new GCC.
I compiled the following versions of Upstart and its immediate dependencies:
upstart: 1.13.2
libnih: 1.0.3
dbus: 1.11.2
json-c: 0.12.1
When I boot, I get the following message:
init: com.ubuntu.Upstart.c:3525: Assertion failed in control_emit_event_emitted: env != NULL
init: Caught abort, core dumped
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000600
Searching online did not yield useful hints - the only relevant issue I found is this, but it is relevant to an older version of Upstart, and my libnih is of the correct version already.
According to comment #8 in the bug report you linked, it is not enough to use version 1.0.3 of libnih -- you have to specifically use the Ubuntu version, as this seems to include dbus fixes which could solve the problem you are seeing. From the bug report:
David Ireland (e-david) wrote on 2013-04-22: #7
I've built libnih
1.0.3 from source and also made sure that upstart builds with that version of the nih-dbus-tool. I'm still having this problem.
James Hunt (jamesodhunt) wrote on 2013-04-22: #8
Which problem? The
crash? If so, you are still using the wrong version of libnih: you
should be using the Ubuntu version (specifically 1.0.3-4ubuntu16) from
here:
https://code.launchpad.net/~ubuntu-branches/ubuntu/raring/libnih/raring
You do not need the --session flag to run a "Session Init" (yes, this
is a little confusing but --session was added for testing a long time
ago and is still required for that). A "Session Init" only requires
"--user".

Resources