Re: Running a source command before launching main command

Mahmood Naderan <[email protected]> Thu, 29 Jul 2021 10:11:13 +0200
Newsgroups gmane.comp.kde.users.kdevelop
Message-ID <CADa2P2UN-gb0k2qZeBgSFEJQt3bRo-0iGT+zECNZx5qaUuozKg@mail.gmail.com>
--000000000000217cd105c83ea6e8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

OK I specified this:

EXECUTABLE: /usr/bin/sh /home/mnaderan/accel-sim-framework/run.sh
/home/mnaderan/accel-sim-framework/gpu-simulator/bin/release/accel-sim.out'
ARGS: long_argument_list


I am not able to Execute because I get

/home/mnaderan/accel-sim-framework/> '/usr/bin/sh
/home/mnaderan/accel-sim-framework/run.sh
/home/mnaderan/accel-sim-framework/gpu-simulator/bin/release/accel-sim.out'
-trace
./hw_run/traces/device-0/11.2/stencil/_i__home_mnaderan_suites_parboil_data=
sets_stencil_small_input_128x128x32_bin__o__home_mnaderan_128x128x32_out___=
_128_128_32_100/traces/kernelslist.g
-config
./gpu-simulator/gpgpu-sim/configs/tested-cfgs/SM86_RTX3070/gpgpusim.config
-config ./gpu-simulator/configs/tested-cfgs/SM86_RTX3070/trace.config
*** Failure: /usr/bin/sh /home/mnaderan/accel-sim-framework/run.sh
/home/mnaderan/accel-sim-framework/gpu-simulator/bin/release/accel-sim.out
has failed to start ***

For the debug I see:

'/usr/bin/sh /home/mnaderan/accel-sim-framework/run.sh
/home/mnaderan/accel-sim-framework/gpu-simulator/bin/release/accel-sim.out'
is not an executable

However, when I run that command in the terminal, there is no problem.


Regards,
Mahmood




On Wed, Jul 28, 2021 at 5:13 PM Ren=C3=A9 J.V. Bertin <[email protected]>
wrote:

> On Wednesday July 28 2021 11:44:23 Mahmood Naderan wrote:
>
> >some variables and preprocessing. I know how to set variables in the
> launch
> >configuration, but I would like to know how to specify that source comma=
nd
> >in the launch configuration where executable, arguments and working
> >directory are set.
>
> Hi,
>
> I suppose there is no clear place to specify a set-up command (I don't us=
e
> this functionality)?
>
> In that case, your best option would be to turn your "source" command int=
o
> a wrapper script that first does the sourcing and then exec's the actuall=
y
> intended command:
>
> ----
> #!/bin/sh
>
> # do your source command
>
> COMMAND=3D"$1"
> shift
> exec ${COMMAND} "$@"
> ---
>
> If your launch configuration is meant to debug your code this will
> probably not work, but you could try this as the command:
>
> sh /path/to/wrapper /path/to/yourExecutable [args]
>
> (this will cause the debugger to see a binary, which at some point will
> overlay itself with your own code).
>
> If that doesn't work either you'll have no other choice but to call
> KDevelop itself via the wrapper script. Or implement the missing feature
> yourself (and propose it for inclusion).
>
> R.
>

--000000000000217cd105c83ea6e8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:tahoma,s=
ans-serif">OK I specified this:</div><div class=3D"gmail_default" style=3D"=
font-family:tahoma,sans-serif"><br></div><div class=3D"gmail_default" style=
=3D"font-family:tahoma,sans-serif">EXECUTABLE: /usr/bin/sh /home/mnaderan/a=
ccel-sim-framework/run.sh /home/mnaderan/accel-sim-framework/gpu-simulator/=
bin/release/accel-sim.out&#39; <br></div><div class=3D"gmail_default" style=
=3D"font-family:tahoma,sans-serif">ARGS: long_argument_list</div><div class=
=3D"gmail_default" style=3D"font-family:tahoma,sans-serif"><br></div><div c=
lass=3D"gmail_default" style=3D"font-family:tahoma,sans-serif"><br></div><d=
iv class=3D"gmail_default" style=3D"font-family:tahoma,sans-serif">I am not=
 able to Execute because I get</div><div class=3D"gmail_default" style=3D"f=
ont-family:tahoma,sans-serif"><br></div><div class=3D"gmail_default" style=
=3D"font-family:tahoma,sans-serif">/home/mnaderan/accel-sim-framework/&gt; =
&#39;/usr/bin/sh /home/mnaderan/accel-sim-framework/run.sh /home/mnaderan/a=
ccel-sim-framework/gpu-simulator/bin/release/accel-sim.out&#39; -trace ./hw=
_run/traces/device-0/11.2/stencil/_i__home_mnaderan_suites_parboil_datasets=
_stencil_small_input_128x128x32_bin__o__home_mnaderan_128x128x32_out____128=
_128_32_100/traces/kernelslist.g -config ./gpu-simulator/gpgpu-sim/configs/=
tested-cfgs/SM86_RTX3070/gpgpusim.config -config ./gpu-simulator/configs/te=
sted-cfgs/SM86_RTX3070/trace.config<br>*** Failure: /usr/bin/sh /home/mnade=
ran/accel-sim-framework/run.sh /home/mnaderan/accel-sim-framework/gpu-simul=
ator/bin/release/accel-sim.out has failed to start ***</div><div class=3D"g=
mail_default" style=3D"font-family:tahoma,sans-serif"><br></div><div class=
=3D"gmail_default" style=3D"font-family:tahoma,sans-serif">For the debug I =
see:</div><div class=3D"gmail_default" style=3D"font-family:tahoma,sans-ser=
if"><br></div><div class=3D"gmail_default" style=3D"font-family:tahoma,sans=
-serif">&#39;/usr/bin/sh /home/mnaderan/accel-sim-framework/run.sh /home/mn=
aderan/accel-sim-framework/gpu-simulator/bin/release/accel-sim.out&#39; is =
not an executable</div><div class=3D"gmail_default" style=3D"font-family:ta=
homa,sans-serif"><br></div><div class=3D"gmail_default" style=3D"font-famil=
y:tahoma,sans-serif">However, when I run that command in the terminal, ther=
e is no problem.</div><div class=3D"gmail_default" style=3D"font-family:tah=
oma,sans-serif"><br></div><div class=3D"gmail_default" style=3D"font-family=
:tahoma,sans-serif"><br></div><div><div dir=3D"ltr" class=3D"gmail_signatur=
e" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><font face=3D"tahoma=
,sans-serif">Regards,<br>Mahmood</font><br><br><br></div></div></div><br></=
div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On=
 Wed, Jul 28, 2021 at 5:13 PM Ren=C3=A9 J.V. Bertin &lt;<a href=3D"mailto:r=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">On Wednesday July 28 2021 11:44:23 M=
ahmood Naderan wrote:<br>
<br>
&gt;some variables and preprocessing. I know how to set variables in the la=
unch<br>
&gt;configuration, but I would like to know how to specify that source comm=
and<br>
&gt;in the launch configuration where executable, arguments and working<br>
&gt;directory are set.<br>
<br>
Hi,<br>
<br>
I suppose there is no clear place to specify a set-up command (I don&#39;t =
use this functionality)?<br>
<br>
In that case, your best option would be to turn your &quot;source&quot; com=
mand into a wrapper script that first does the sourcing and then exec&#39;s=
 the actually intended command:<br>
<br>
----<br>
#!/bin/sh<br>
<br>
# do your source command<br>
<br>
COMMAND=3D&quot;$1&quot;<br>
shift<br>
exec ${COMMAND} &quot;$@&quot;<br>
---<br>
<br>
If your launch configuration is meant to debug your code this will probably=
 not work, but you could try this as the command:<br>
<br>
sh /path/to/wrapper /path/to/yourExecutable [args]<br>
<br>
(this will cause the debugger to see a binary, which at some point will ove=
rlay itself with your own code).<br>
<br>
If that doesn&#39;t work either you&#39;ll have no other choice but to call=
 KDevelop itself via the wrapper script. Or implement the missing feature y=
ourself (and propose it for inclusion).<br>
<br>
R.<br>
</blockquote></div>

--000000000000217cd105c83ea6e8--