Author Topic: Can CB use a linux shell script to build a project?  (Read 1076 times)

Offline sodev

  • Almost regular
  • **
  • Posts: 157
Re: Can CB use a linux shell script to build a project?
« Reply #15 on: June 22, 2018, 01:10:04 pm »
This happens when you don't read the full thread ;D.

You are using the targets for something different than i and the CodeBlocks wizards and documentation do! We use them to build different configurations of the same thing while you use them to build different things.

Since i never used your path i cant contribute anything to it and i don't want to confuse you with mine so i better stop here :). Just a little strange that oBFusCATed suggets a path contradicting the integrated helper functions to a beginner.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: Can CB use a linux shell script to build a project?
« Reply #16 on: June 22, 2018, 06:43:53 pm »
sodev: What do you mean by integrated helper functions? The wizard scripts?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sodev

  • Almost regular
  • **
  • Posts: 157
Re: Can CB use a linux shell script to build a project?
« Reply #17 on: June 22, 2018, 09:15:13 pm »
Yes, these, and to some extent the wiki as well.

Offline Marnix

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Can CB use a linux shell script to build a project?
« Reply #18 on: June 27, 2018, 09:15:50 pm »
== long post, but oBFusCATed pls read  :) ==

Ok, I can now build the library and the application in one project and it runs as it should. But now, I have this weird problem with the debugger.

Here’s the problem and results of the testing I already did:

Problem: when I start the debugger the terminal window does not start

My own testing:
1. Upgraded to CB 17.12
2. The project builds the library and the application without errors
3. The application runs fine outside CB
4. The application runs fine from within CB using “run” (CTRL F10). The terminal window starts, prints output and accepts input.
5. When I start the application in the debugger with “start/continue” (F8), it looks like it gets into a loop. I think it's waiting for input that doesn't come because of the missing terminal window. Only the “stop debugger” and “break debugger” buttons are clickable but they don seem to work.
6. Clicking “stop debugger” or “break debugger” gives the following msg in the debugger window:
“Trying to interrupt process with pid: 7349; child pid: 7349 gdb pid: 7343”.
When I kill -9 the last pid, the debugger stops.
5. When I start the application in the debugger with “run to cursor” (F4) to a point where no user input is yet required, I can F7 through it, but there is no terminal window.
6. My other projects that only build an application and no library run fine in debug mode, the terminal window starts normally.

Because everything else works, but for the debugger in this particular project that builds a library and an application I think I missed a correct setting somewhere?

Here is the output from the debugger window:

=======================
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
ificonsole
Adding source dir: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/
Adding source dir: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/
Adding file: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole
Changing directory to: "/home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan"
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args "/home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole"
done
Setting breakpoints
Debugger name and version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Child process PID: 7434
=======================
The difference with my projects with only an application and no library is the last line with the child process.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: Can CB use a linux shell script to build a project?
« Reply #19 on: June 27, 2018, 09:52:06 pm »
Can you enable full logging in the debugger's setting and post the log using code tags?
What terminal are you using?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Marnix

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Can CB use a linux shell script to build a project?
« Reply #20 on: June 28, 2018, 08:32:25 pm »

The terminal I use is ( copied from settings->environment->general settings):  gnome-terminal --disable-factory -t $TITLE -x


Here's the full log:

The last  3 lines of the log were written when I clicked "stop debugger" twice and then kill -9 5087

I see output in the logging that was supposed to go to the terminal window.

Code: [Select]
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
ificonsole
Adding source dir: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/
Adding source dir: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/
Adding file: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole
Changing directory to: "/home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan"
Set variable: LD_LIBRARY_PATH=.:

[debug]Command-line: /usr/bin/gdb -nx -fullname -quiet  -args "/home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole"
[debug]Working dir : /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4

Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args "/home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole"
done

[debug]> set prompt >>>>>>cb_gdb:

Setting breakpoints

[debug]Reading symbols from /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
[debug]Copyright (C) 2016 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory "/home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/"
[debug]Source directories searched: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> set args -d 3 -configdir escape -story escape.dat
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /home/marnix/XVAN 2.3.4/03 - ifi-xvan2-3-4/xvan/ificonsole -d 3 -configdir escape -story escape.dat
[debug][Thread debugging using libthread_db enabled]
[debug]Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[debug]IFIConsole, passing start json, {"configdir":"escape","datadir":".","story":"escape.dat"}
[debug]IFIClient, setting log level to 3

Child process PID: 5093

[debug][New Thread 0x7ffff6cdf700 (LWP 5093)]
[debug]-- XVAN 2.3.4 interpreter --
[debug](c) Marnix van den Bos
[debug]You must escape! version 1.0 - English
[debug]Suddenly you are here. You have no recollection of anything. Your mind is empty, like it just started.
[debug]You are in some sort of a building, but you can also see through it. You faintly see meadows and a blue sky. The building somehow merges with the outside world. It's like your surroundings are not yet finished.You can also make out blue, red and green objects in the near distance and a shiny object that looks like gold.
[debug]Very weird...
[debug]Someone walks into the room. A big nondescript guy. He is carrying a tablet. When he sees you he looks surprised and a bit confused.
[debug]'What's going on? Who put you in here already? The world isn't even finished. They all know that the player object should only be enabled during he final test cases and regression tests.' We're not that far yet!
[debug]He looks at you and smiles. 'I'm sorry buddy. This shouldn't have happened. I'm going to fix this right away.After a few swipes on the tablet screen he starts typing. You hear him mumbling something about 'commenting out' and 'recompiling'.
[debug]And then everything goes black again....
[debug]Hit a key...
[debug]========================= I N T R O D U C I N G  X V A N ======================
[debug]This is a short sample story for XVAN 2.1.It has 7 rooms and 29 objects, including the player and one npc named Fred.The story contains several puzzles and you need to interact with Fred to solve some of them. You have one goal: escape.
[debug]Disclaimer: I wrote this story to illustrate XVAN's possibilities from a technical perspective. It was not my intention to produce a high level piece of prose.
[debug]===============================================================================
[debug][chest room](use chest room)
[debug]This is a room with an exit leading east.
[debug]There is [an old wooden chest](use old wooden chest) here, which is closed.
[debug][lamp](use lamp)[lamp](use lamp)[lamp](use lamp)[lamp](use lamp)[lamp](use lamp)[lamp](use lamp)[lamp](use lamp)>

Trying to interrupt process with pid: 5093; child pid: 5093 gdb pid: 5087

[debug]225 ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: No such file or directory.
[debug]Thread 2 "ificonsole" received signal SIGINT, Interrupt.
[debug][Switching to Thread 0x7ffff6cdf700 (LWP 5093)]
[debug]pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
[debug]>>>>>>cb_gdb:

Trying to interrupt process with pid: 5093; child pid: 5093 gdb pid: 5087
Trying to interrupt process with pid: 5093; child pid: 5093 gdb pid: 5087
Debugger finished with status 1

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: Can CB use a linux shell script to build a project?
« Reply #21 on: June 28, 2018, 10:49:48 pm »
Interesting. C::B didn't try to start the terminal. :(
What is the type of the target you're using?
Can you reproduce this problem with a simple default console project?
Is the pid of the child (your program) correctly detected by C::B?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Marnix

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Can CB use a linux shell script to build a project?
« Reply #22 on: June 29, 2018, 06:13:28 pm »
I build a virtual target called "ifi-xvan"

It has 2 build targets:
- ificonsole which is a console application
- ifigame, which is a dynamic library

The order in the virtual target is opposite what you told me: application first, then library. Otherwise it won't build. It starts building from the bottom up.

All my projects with one target console application build and debug fine.

Regarding the PID:

After the debugger starts it says:
Child process PID: 4228

I cannot find this PID. But when I click the stop debugger button it says: "Trying to interrupt process with pid: 4228; child pid: 4228 gdb pid: 4217"

PID 4217 is ificonsole, when I kill it the debugger stops.

Does this make sense?

(maybe I should just delete the .cbp .depend and .layout files and recreate the project?)


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: Can CB use a linux shell script to build a project?
« Reply #23 on: June 29, 2018, 06:41:42 pm »
No it doesn't make sense. Pid 4217 should be the pid of gdb's executable. Killing gdb also stops debugging.

Can you create a simple console project with the wizard and tell me if showing the terminal works in it?
What is the value of Project -> Properties -> Build targets -> ificonsole -> Type?
Is "pause when execution ends" checked?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Marnix

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Can CB use a linux shell script to build a project?
« Reply #24 on: July 01, 2018, 05:00:37 pm »

oBFusCATed, you found it!

The "pause when execution ends" was not checked. I checked the box it and now the debug window comes up.

But is it normal behavior when you uncheck the button? I can't find it in the manual.

Thanks for solving this.




Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10904
    • Travis build status
Re: Can CB use a linux shell script to build a project?
« Reply #25 on: July 01, 2018, 06:30:06 pm »
It is normal, but annoying. I don't know why it is like this.
I have the desire to change it, but I haven't found the time.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]