How to step through the gio command
Enough time has passed since I created this ticket:
https:/
for me to conclude this will not be solved any time soon. So now I am seeking to download the code myself to step through it in my Ubuntu 22.04 OS. I have not ever done this before for an Ubuntu package.
I see the source code is available at:
https:/
What compiler, and what IDE, do I need to do this?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu glib2.0 Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Stephen
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
There should not be any need for compiling yourself, because the debug packages are available (usually on a specific server, but also available on the launchpad servers).
Let's try finding them. For diagnostic purposes, what is the output of the commands
uname -a
lsb_release -crid
dpkg -l | grep libglib2.0
(In your case the debug package needed probably is https:/
Additional remarks:
Building packages usually is done with command line tools, not with a GUI.
The tools and compilers needed for creating a package are defined in the source of the package itself. The commands
sudo apt install build-essential
sudo apt build-depends glib2.0
are supposed to install all requited tools for compiling the glib2.0 package yourself.
Revision history for this message
|
#2 |
Thank you Manfred for your reply :) . The information you requested:
stephen@stephen:~$ uname -a
Linux stephen.tower 5.17.0-1020-oem #21-Ubuntu SMP PREEMPT Fri Oct 14 09:33:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
stephen@stephen:~$ lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
stephen@stephen:~$ dpkg -l | grep libglib2.0
ii libglib2.0-0:amd64 2.72.4-0ubuntu1 amd64 GLib library of C routines
ii libglib2.0-0:i386 2.72.4-0ubuntu1 i386 GLib library of C routines
ii libglib2.0-bin 2.72.4-0ubuntu1 amd64 Programs for the GLib library
ii libglib2.0-data 2.72.4-0ubuntu1 all Common files for GLib library
stephen@stephen:~$
Revision history for this message
|
#3 |
The finding in your bug report seems correct.
Apparently the debug packages for the updated version are missing on the ddeb server.
Try downloading the following packages
https:/
https:/
and install them (e.g. with the command sudo dpkg -i *.ddeb)
Finally try whether you now can debug the gio program.
Revision history for this message
|
#4 |
Thank you Manfred for you reply.
I installed the two downloads you recommended. I then attempted to use the gdb command to get a program listing. Here is the essential details of how it went:
*****
stephen@stephen:~$ gdb --args /usr/bin/gio set "/home/
Registered pretty printers for UE4 classes
Reading symbols from /usr/bin/gio...
Reading symbols from /usr/lib/
(gdb) list
239 ../../.
(gdb) exit
stephen@stephen:~$ sudo find / -iname gio-tool.c
find: ‘/proc/267533’: No such file or directory
find: ‘/run/user/
find: ‘/run/user/
stephen@stephen:~$
*****
The needed file "gio-tool.c" is nowhere to be found on my computer. I did find a listing of it here:
https:/
But I do not know for sure if this is the right source code version. And probably there are others missing,- that file being only first it does not find. What is the proper way to get this, and all other needed files to step through the gio command, so gdb can access it?
Revision history for this message
|
#5 |
Apparently the debug packages are the right ones, no complaints in the output about the package.
I assume that the missing file is from the original source of glib2.0, something like https:/
You probably have to download the complete source that was used for creating the package.
The following may work:
Edit the file /etc/apt/
Run the commands
sudo apt update
cd ~
md src
cd src
apt source glib2
Finally try debugging the gio program again; you will eventually have to add a parameter pointing to the directory with the source files, maybe something like
gdb --directory=~/src --args /usr/bin/gio set "/home/
(You can of course use a directory name different from src)
Revision history for this message
|
#6 |
Here is the contents of the file: /etc/apt/
deb http://
deb http://
deb http://
deb http://
There are no lines to uncomment here.
Revision history for this message
|
#7 |
Duplicate each line and change deb to deb-src in one of them
deb http://
deb-src http://
deb http://
deb-src http://
...
Revision history for this message
|
#8 |
I added your recommended entries into the /etc/apt/
The command "apt source glib2" returned an error. However this command did work "apt source glib2.0". Here are the contents of the directory now:
stephen@
glib2.0-2.72.4 glib2.0_
The file "gio-tool.c" now exists:
stephen@
./glib2.
But gdb still does not find it:
stephen@
Registered pretty printers for UE4 classes
Reading symbols from /usr/bin/gio...
Reading symbols from /usr/lib/
(gdb) list
239 ../../.
I got the same result when I tried the directories: '~/Projects/
What would be the correct command to launch gdb with to step through the gio command?
Revision history for this message
|
#9 |
Did the -directory option have one or two dash characters? As far as the documentation tells, it needs two.
Revision history for this message
|
#10 |
That was one dash. And I am not even sure that was the right dash because it seems to be a different character than the commonly one used for dash. I corrected the command to use two dashes by using the minus sign key on my keyboard. However, when the corrected command is entered, gdb still does not find the file "gio-tool.c".
stephen@stephen:~$ gdb --directory=
Registered pretty printers for UE4 classes
Reading symbols from /usr/bin/gio...
Reading symbols from /usr/lib/
(gdb) list
239 ../../.
(gdb)
The error message gives a relative path to where the file is expected. What gdb command will show the absolute path the error message's relative path is relative to?
Revision history for this message
|
#11 |
I have no experience with gdb; I have used other debuggers, and even that is years ago.
Suggestions:
start the debugger after changing directory into the directory where the gio-tool.c file is located
or
create a path, such that the gio-tool.c file can be found from there via ../../.
That is something like
cd ~/Projects/
mkdir -p work/work/work
cd work/work/work
ls ../../.
Revision history for this message
|
#12 |
After I used the cd command within gdb I got a listing:
stephen@stephen:~$ gdb -q --directory=
Registered pretty printers for UE4 classes
Reading symbols from /usr/bin/gio...
Reading symbols from /usr/lib/
(gdb) cd /home/stephen/
Working directory /home/stephen/
(gdb) list
239 g_printerr (" open %s\n", _("Open files with the default application"));
240 g_printerr (" rename %s\n", _("Rename a file"));
241 g_printerr (" remove %s\n", _("Delete one or more files"));
242 g_printerr (" save %s\n", _("Read from standard input and save"));
243 g_printerr (" set %s\n", _("Set a file attribute"));
244 g_printerr (" trash %s\n", _("Move files or directories to the trash"));
245 g_printerr (" tree %s\n", _("Lists the contents of locations in a tree"));
246 g_printerr ("\n");
247 g_printerr (_("Use %s to get detailed help.\n"), "“gio help COMMAND”");
248 exit (1);
Now I can continue to figure out how to step through the code. Thanks for your help :)
Revision history for this message
|
#13 |
I decided I should use gdbgui because its gui would make it easier to step through code.
Upon starting up gdbgui I see this error in the source code window:
file not found: ./debian/
I thought I had specified the directory where this file is to be found in the command I started up gdbgui with. This is:
gdbgui --project=
It appears the --project argument is not doing what I thought it would. So now I seek to move the source files to where gdbgui expects them to be. The trouble is the "file not found" error gives a relative path, and I have no idea what path this is relative to. How do find out what gdbgui's current working directory (PWD) is so I can move the source files to where they are expected?
The way I read the error message's path it is the equivalent of
./gio/gio-tool.c
Revision history for this message
|
#14 |
Try with /home/stephen/
Explanation:
./debian/
./ current working directory
debian/ down into the subdirectory debian
build/ down into the subdirectory build
deb/ down into the subdirectory deb
../ one directoy up (i.e. back to build)
../ one directoy up (i.e. back to debian)
../ one directoy up (i.e. back to the current working directory)
gio/ down into the subdirectory gio
gio-tool.c opening the file.
so in fact that simply is ./gio/giio-tool.c
Revision history for this message
|
#15 |
This problem is solved. I found that the --remap-sources argument accepts the relative path given in the error message. The command is:
gdbgui --project=
The --project argument is for the folders pane. It specifies the path all paths in the pane will be relative to.