Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-08

Display option problem..

14 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Weustink
to Jesus Reyes: Sorry, the email thread was stored in other computer, { Don't think so. But somewhere the…
Show quoted text 20 lines
At 16:17 1-8-2003 -0500, Jesus Reyes wrote: [snip] >It seems that when the Fdebugger creates the debugger process (the >first time the program is about to run) the environment (FEnviroment) >is empty (doRunProject->doInitProjectRun->doInitDebugger-> >fDebugger:=TgdbMiDebuger.create [0]) and this value is used in the >CreateProcess call (deep into fDebugger.Init). > >After that the call >Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment); >[1] >tries to update the environment but it only assign to >FDebugger.FEnviroment. > >It seems that this value (I can confirm that it is the wished >environment) is never propagated? Hmm... makes sense. I'll fix that.

Ok, I changed environment handling. Now the vars are directly passed to the debuggee environment. The debugger itself has it's own environment (you currently cant modify it)

Marc

Reply by email

Jesus Reyes

Sorry, the email thread was stored in other computer,

{
Don't think so. But somewhere the DISPLAY variable is lost. Maybe you want to find out yourself:
The environment variables are given to the debugger in debugmanager.pas line 1338:
Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment); You can add a writeln(FDebugger.Environment.Text); to see the variables.
If you follow the AssignEnvironmentTo with "find declaration" you will see,
that there is not much code in there. It fetches the current env vars and
replaces the overrides.
The debugger creates a TProcess and assigns the variables to it in debugger/cmdlinedebugger.pp line 180.
Just add a few writelns to find out, where the DISPLAY variable is lost.
Mattias
}

I tried that.

It seems that when the Fdebugger creates the debugger process (the first time the program is about to run) the environment (FEnviroment) is empty (doRunProject->doInitProjectRun->doInitDebugger-> fDebugger:=TgdbMiDebuger.create [0]) and this value is used in the CreateProcess call (deep into fDebugger.Init).

After that the call
Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment); [1]
tries to update the environment but it only assign to FDebugger.FEnviroment.

It seems that this value (I can confirm that it is the wished environment) is never propagated? to the debugger running process before running the application. The application doesn't receive the intended enviroment in my case, I added the following line to the application code:

WriteLn('DISPLAY env var= ', GetEnvironmentVariable('DISPLAY'));

it should display: DISPLAY env var= quimica:0.0 but it gives: DISPLAY env var= :0.0

in next runs [0] doesn't get called and before and after the [1] call the enviroment that shows it's ok, so I think it is just not propagated? to the running debugger process but I'm not sure.

regards.

Jesus Reyes A.

_________________________________________________________ Do You Yahoo!?
La mejor conexi�n a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx

Reply by email

Marc Weustink
to Jesus Reyes

At 16:17 1-8-2003 -0500, Jesus Reyes wrote:

[snip]

Show quoted text 14 lines
It seems that when the Fdebugger creates the debugger process (the first time the program is about to run) the environment (FEnviroment) is empty (doRunProject->doInitProjectRun->doInitDebugger-> fDebugger:=TgdbMiDebuger.create [0]) and this value is used in the CreateProcess call (deep into fDebugger.Init). After that the call Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment); [1] tries to update the environment but it only assign to FDebugger.FEnviroment. It seems that this value (I can confirm that it is the wished environment) is never propagated?

Hmm... makes sense. I'll fix that.

Marc

Reply by email

Jesus Reyes
to Marc Weustink: I can remember that I've seen such constructs. On my RH73 box it still is, however it is…

--- Marc Weustink escribi�: > At 12:00

Jesus Reyes wrote 30 lines
>Hi Marc, I've found some problems: > >Environment constructs like this: > >mc=() { mkdir -p $HOME/.mc/tmp 2>/dev/null; > chmod 700 $HOME/.mc/tmp; > MC=$HOME/.mc/tmp/mc-$$; > /usr/bin/mc -P "$@" >"$MC"; > cd "`cat $MC`"; > rm -i -f "$MC"; > unset MC >} I can remember that I've seen such constructs. On my RH73 box it still is, however it is not a part of the environment, it is a shell function. IMO this one can be ignored. On my RH9 box it is solved trough an alias. However.... I've tried several combinations of startup on both boxes, I even created a test function myself, I couldn't get the function to show up in the run->environment options. Can you tell me how to get it into the environment, then I can try to fix it. Marc

it is set through /etc/bashrc -> /etc/profile.d/mc.sh

I think it is automatically installed with midnight commander

I will set to you the files.

Jesus Reyes A.

_________________________________________________________ Do You Yahoo!?
La mejor conexi�n a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx

Reply by email

Marc Weustink
to Jesus Reyes: directly passed to the environment (you Hi Marc, I've found some problems: Environment…
Jesus Reyes wrote 12 lines
Hi Marc, I've found some problems: Environment constructs like this: mc=() { mkdir -p $HOME/.mc/tmp 2>/dev/null; chmod 700 $HOME/.mc/tmp; MC=$HOME/.mc/tmp/mc-$$; /usr/bin/mc -P "$@" >"$MC"; cd "`cat $MC`"; rm -i -f "$MC"; unset MC }

I can remember that I've seen such constructs. On my RH73 box it still is, however it is not a part of the environment, it is a shell function. IMO this one can be ignored.
On my RH9 box it is solved trough an alias.

However.... I've tried several combinations of startup on both boxes, I even created a test function myself, I couldn't get the function to show up in the run->environment options.

Can you tell me how to get it into the environment, then I can try to fix it.

Marc

Reply by email

Jesus Reyes
to Jesus Reyes: Sorry, the email thread was stored in other computer, { Don't think so. But somewhere the…

----- Original Message -----

Earlier message 41 lines
From: Marc Weustink To: Sent: Friday, August 01, 2003 6:28 PM Subject: Re: [lazarus] Display option problem.. > At 23:24 1-8-2003 +0200, I wrote: > >At 16:17 1-8-2003 -0500, Jesus Reyes wrote: > > > >[snip] > > > >>It seems that when the Fdebugger creates the debugger process (the > >>first time the program is about to run) the environment (FEnviroment) > >>is empty (doRunProject->doInitProjectRun->doInitDebugger-> > >>fDebugger:=TgdbMiDebuger.create [0]) and this value is used in the > >>CreateProcess call (deep into fDebugger.Init). > >> > >>After that the call > >>Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment); > >>[1] > >>tries to update the environment but it only assign to > >>FDebugger.FEnviroment. > >> > >>It seems that this value (I can confirm that it is the wished > >>environment) is never propagated? > > > >Hmm... makes sense. I'll fix that. > > Ok, I changed environment handling. Now the vars are directly passed to the > debuggee environment. The debugger itself has it's own environment (you > currently cant modify it) > > Marc > I will test this next monday. Thanks Jesus Reyes A.

Reply by email

Jesus Reyes
Ok, I changed environment handling. Now the vars are

directly passed to
the

debuggee environment. The debugger itself has it's own

environment (you

currently cant modify it) Marc

Hi Marc, I've found some problems:

Environment constructs like this:

mc=() {  mkdir -p $HOME/.mc/tmp 2>/dev/null;
 chmod 700 $HOME/.mc/tmp;
 MC=$HOME/.mc/tmp/mc-$$;
 /usr/bin/mc -P "$@" >"$MC";
 cd "`cat $MC`";
 rm -i -f "$MC";
 unset MC
}

confuse the debugger, here is the output mixed with other valid ones:

[snip]
TCmdLineDebugger.SendCmdLn "-gdb-set env MAIL=/var/spool/mail/prog" TCmdLineDebugger.SendCmdLn "-gdb-set env mc=() { mkdir -p $HOME/.mc/tmp 2>/dev/null;
chmod 700 $HOME/.mc/tmp;
MC=$HOME/.mc/tmp/mc-$$;
/usr/bin/mc -P "$@" >"$MC";
cd "`cat $MC`";
rm -i -f "$MC";
unset MC
}"
TCmdLineDebugger.SendCmdLn "-gdb-set env
NLSPATH=/usr/share/locale/%l/%N"
[Debugger] Log output: &"chmod 700 $HOME/.mc/tmp;\n" [Debugger] Log output: &"Undefined command: \"chmod\". Try \"help\".\n"
TCmdLineDebugger.SendCmdLn "-gdb-set env OLDPWD=/home/prog" [Debugger] Log output: &"MC=$HOME/.mc/tmp/mc-$$;\n" [Debugger] Log output: &"Undefined command: \"MC\". Try \"help\".\n" TCmdLineDebugger.SendCmdLn "-gdb-set env
PATH=/usr//bin:/bin:/usr/bin::/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/prog/bin" [Debugger] Log output: &"/usr/bin/mc -P \"" >\"$MC\";\n" [Debugger] Log output: &"Undefined command: \"\". Try \"help\".\n" TCmdLineDebugger.SendCmdLn "-gdb-set env PWD=/home/prog/lazarus" [Debugger] Log output: &"cd \"`cat $MC`\";\n"
[Debugger] Log output: &"\"`cat $MC`\";: No such file or directory.\n"
TCmdLineDebugger.SendCmdLn "-gdb-set env QT_XFT=0" [Debugger] Log output: &"rm -i -f \"$MC\";\n"
TCmdLineDebugger.SendCmdLn "-gdb-set env SECURE_LEVEL=2" [Debugger] Log output: &"unset MC\n"
[Debugger] Log output: &"Undefined unset command: \"MC\". Try \"help unset\".\n"
TCmdLineDebugger.SendCmdLn "-gdb-set env
SESSION_MANAGER=local/pinguino:/tmp/.ICE-unix/2085" [Debugger] Log output: &"}\n"
[Debugger] Log output: &"Undefined command: \"\". Try \"help\".\n"

another problem: If I put a check mark to the Display option, the following code executes:

322     procedure TRunParamsOptions.AssignEnvironmentTo(Strings:
TStrings);
323     begin
324       IDEProcs.AssignEnvironmentTo(Strings,UserOverrides);
325       if UseDisplay then
326         Strings.Values['DISPLAY']:=Display;
327     end;

the problem is in the line 326: TApplication.HandleException Operation not allowed on sorted StringLists.

If I uncheck the display option, all was ok until the moment to query the program info:

[snip]
TCmdLineDebugger.SendCmdLn "-gdb-set env "
[TDebugger.SetFileName] /home/prog/work/Lazarus/lgrid/test1 TCmdLineDebugger.SendCmdLn "-file-exec-and-symbols /home/prog/work/Lazarus/lgrid/test1"
TCmdLineDebugger.SendCmdLn "-gdb-set language pascal" [TDebugManager.OnDebuggerChangeState] state: dsStop [TDebugManager.DoInitDebugger] END
TGDBMIBreakPoint.SetLocation A TRUE TRUE
TGDBMIBreakPoint.SetLocation A TRUE TRUE
TCmdLineDebugger.SendCmdLn "-break-insert unittest1.pas:636" TCmdLineDebugger.SendCmdLn "-break-insert unittest1.pas:593" TCmdLineDebugger.SendCmdLn "-environment-cd
/home/prog/work/Lazarus/lgrid/"
TCmdLineDebugger.SendCmdLn "-gdb-set language pascal" TCmdLineDebugger.SendCmdLn "-break-insert -t main" TCmdLineDebugger.SendCmdLn "-exec-run"
TCmdLineDebugger.SendCmdLn "-break-insert FPC_RAISEEXCEPTION" TCmdLineDebugger.SendCmdLn "-break-insert FPC_BREAK_ERROR" TCmdLineDebugger.SendCmdLn "info program"
[Debugger] Target PID: 0
[TDebugManager.OnDebuggerChangeState] state: dsError Ooops, the debugger entered the error state

but I dont know if it is related. One question: why is the debug process running between application runs?.

Jesus Reyes A.

_________________________________________________________ Do You Yahoo!?
La mejor conexi�n a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx

Reply by email

Marc Weustink
to Jesus Reyes
Jesus Reyes wrote 14 lines
Hi Marc, I've found some problems: Environment constructs like this: mc=() { mkdir -p $HOME/.mc/tmp 2>/dev/null; chmod 700 $HOME/.mc/tmp; MC=$HOME/.mc/tmp/mc-$$; /usr/bin/mc -P "$@" >"$MC"; cd "`cat $MC`"; rm -i -f "$MC"; unset MC } confuse the debugger, here is the output mixed with other valid ones:

Hmmm.. have to check this.

Show quoted text 13 lines
another problem: If I put a check mark to the Display option, the following code executes: 322 procedure TRunParamsOptions.AssignEnvironmentTo(Strings: TStrings); 323 begin 324 IDEProcs.AssignEnvironmentTo(Strings,UserOverrides); 325 if UseDisplay then 326 Strings.Values['DISPLAY']:=Display; 327 end; the problem is in the line 326: TApplication.HandleException Operation not allowed on sorted StringLists.

Ah, I already fixed that one, but only committed the debugger sources. It's in CVS now

Ooops, the debugger entered the error state but I dont know if it is related.

Yep, it is.

One question: why is the debug process running between application runs?.

Why not ?

The idea was that firing up gdb once would gain some time .

Marc

Reply by email

Jesus Reyes
to Marc Weustink

--- Marc Weustink escribi�: > At 12:00

Jesus Reyes wrote 20 lines
>Hi Marc, I've found some problems: > >Environment constructs like this: > >mc=() { mkdir -p $HOME/.mc/tmp 2>/dev/null; > chmod 700 $HOME/.mc/tmp; > MC=$HOME/.mc/tmp/mc-$$; > /usr/bin/mc -P "$@" >"$MC"; > cd "`cat $MC`"; > rm -i -f "$MC"; > unset MC >} > >confuse the debugger, here is the output mixed with other valid ones: Hmmm.. have to check this.

It's working now!, however I need to add a mc="" in Environment user overrides otherway the problem persist:

TCmdLineDebugger.SendCmdLn "info program"
[Debugger] Target PID: 0
[TDebugManager.OnDebuggerChangeState] state: dsError Ooops, the debugger entered the error state

Show quoted text 7 lines
>One question: why is the debug >process running between application runs?. Why not ? The idea was that firing up gdb once would gain some time .

Now that it's working I don't see why not ;), however before your fixes, it occured to me that the environment handling would be much easier ;).

by the way another question: are you planning to add a debug console, so the user can 'talk' to the debugger?

Thanks.

Jesus Reyes A.

ps. i

_________________________________________________________ Do You Yahoo!?
La mejor conexi�n a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx

Reply by email

Jesus Reyes
to Marc Weustink: Hmmm.. have to check this. Ah, I already fixed that one, but only committed the debugger…
There is a trick to have something like watches. Tooltip evaluation is working. If you move your mouse to an expression, it gets evaluated. Nothing new. However if you select a more complex expression, the selection gets evaluated. And if the expression you want

to

evaluate isn't in code, just type the expression (behind a coomment) somewhere in you code, select it, and it gets evaluated :-)

Oh, I discover it by accident. The only problem would be that gdb doesn't know how to dereferece pointers to objects and don't recognize properties, in such case in command line I add a ^ operator and use the underlaying field (if it apply) for the property. Anyway the selection evaluation its cool. I hope some day gdb will be improved.

Jesus Reyes A.

Reply by email

Marc Weustink
to Marc Weustink: Hmmm.. have to check this. Ah, I already fixed that one, but only committed the debugger…
Jesus Reyes wrote 7 lines
----- Original Message ----- From: Marc Weustink > At 14:24 2-8-2003 -0500, Jesus Reyes wrote: > > >by the way another question: are you planning to add a debug console, > >so the user can 'talk' to the debugger?

[snip]

Show quoted text 5 lines
> What commands would you like ? > It's funny, I thought about it because the watches functionality is unfinished and I was in the need for that.

There is a trick to have something like watches.
Tooltip evaluation is working. If you move your mouse to an expression, it gets evaluated. Nothing new. However if you select a more complex expression, the selection gets evaluated. And if the expression you want to evaluate isn't in code, just type the expression (behind a coomment) somewhere in you code, select it, and it gets evaluated :-)

Show quoted text 8 lines
But as debugging functionality gets completed (watches, evaluate, conditional breakpoints, cpu, etc) I don't really see the need for it but I'm not a gdb expert, so maybe others can give more arguments to support or reject the idea. Some times I just need to set a conditional break point, check some values and go, some others I had to disassemble one block of code, inspect some registers, etc. So one thing I would add its flexibility.

These are all thing planned to be implemented some day.

More funny, I like the idea more for what I don't know that for what I know :).

:)

Marc

Reply by email

Jesus Reyes
to Marc Weustink: Hmmm.. have to check this. Ah, I already fixed that one, but only committed the debugger…

----- Original Message -----

Earlier message 62 lines
From: Marc Weustink To: Sent: Saturday, August 02, 2003 3:31 PM Subject: RE: [lazarus] Display option problem.. > At 14:24 2-8-2003 -0500, Jesus Reyes wrote: > > --- Marc Weustink escribi�: > At 12:00 > >2-8-2003 -0500, Jesus Reyes wrote: > > > > > > >Hi Marc, I've found some problems: > > > > > >One question: why is the debug > > > >process running between application runs?. > > > > > > Why not ? > > > > > > The idea was that firing up gdb once would gain some time . > > > > > > >Now that it's working I don't see why not ;), however before your > >fixes, it occured to me that the environment handling would be much > >easier ;). > > The environment was accidently OK. When creating the process, the > environment of gdb was set. And initially gdb copies it. But what if gdb > requires a different environment than the debuggee ? > > >by the way another question: are you planning to add a debug console, > >so the user can 'talk' to the debugger? > > I've been thinking about it. The debugger class has an option for it, but I > used that only for debugging. One has to know exactly what one is doing, > otherwise one would interfere with normal operation. > For instance: > * setting or worse removing breakpoins > * executing mi or non mi commands (the parsing of the result difers) > etc > > What commands would you like ? > It's funny, I thought about it because the watches functionality is unfinished and I was in the need for that. But as debugging functionality gets completed (watches, evaluate, conditional breakpoints, cpu, etc) I don't really see the need for it but I'm not a gdb expert, so maybe others can give more arguments to support or reject the idea. Some times I just need to set a conditional break point, check some values and go, some others I had to disassemble one block of code, inspect some registers, etc. So one thing I would add its flexibility. More funny, I like the idea more for what I don't know that for what I know :). Regads. Jesus Reyes A.

Reply by email

Marc Weustink
to Marc Weustink: I can remember that I've seen such constructs. On my RH73 box it still is, however it is…
Show quoted text 6 lines
it is set through /etc/bashrc -> /etc/profile.d/mc.sh I think it is automatically installed with midnight commander I will set to you the files.

Catch. Your mc.sh has an additional line: export -f mc

Now I get them as well. IMO it is not an environment var and it should not be in the run->run parameters - environment in the fist place. It makes no sense.

You can work around it with executing export -nf mc before running lazarus.

Marc

Reply by email

Marc Weustink
to Marc Weustink: Hmmm.. have to check this. Ah, I already fixed that one, but only committed the debugger…
Jesus Reyes wrote 16 lines
--- Marc Weustink escribi�: > At 12:00 2-8-2003 -0500, Jesus Reyes wrote: > > >Hi Marc, I've found some problems: > >One question: why is the debug > >process running between application runs?. > > Why not ? > > The idea was that firing up gdb once would gain some time . > Now that it's working I don't see why not ;), however before your fixes, it occured to me that the environment handling would be much easier ;).

The environment was accidently OK. When creating the process, the environment of gdb was set. And initially gdb copies it. But what if gdb requires a different environment than the debuggee ?

by the way another question: are you planning to add a debug console, so the user can 'talk' to the debugger?

I've been thinking about it. The debugger class has an option for it, but I used that only for debugging. One has to know exactly what one is doing, otherwise one would interfere with normal operation. For instance:
* setting or worse removing breakpoins
* executing mi or non mi commands (the parsing of the result difers) etc

What commands would you like ?

Marc

Reply by email