Link to home
Start Free TrialLog in
Avatar of AbhiJeet
AbhiJeet

asked on

Debug Delphi exe

I launch delphi app app1 from another Delphi application app2

How to debug app1?

Both running from same machine and I have source for both
Avatar of huacat
huacat

Please create a project group, and add them to the same project group, then just debug it like normal.
Please remember build all before run/debug it.
Avatar of Geert G
is 1 app a DLL ?
huacat, where did you get that idea ?

in the run menu, you have a "parameters ..." menu option
open that and set app2 as host application

you can use the browse button to find the application app2 directory
I remember I use the project group to debug apps long time ago, I remember that worked for me(Maybe I'm wrong, 10+ year ago), at least, I conside it works for EXE/DLL projects.
Hi Geert,

There no Delphi installed at this machine right now, Would you mind try the project group and post the result here?
delphi only debugs the active project
OK, Thanks.
i thought it was normal to check a solution when you provide one
usually before you provide it

i verified my solution, but also checked on google and found:
https://www.youtube.com/watch?v=T94rhoV6zNM

and even debugging a com+ component
https://edn.embarcadero.com/article/28416
Avatar of AbhiJeet

ASKER

Both are exes
Go to Tools - Options - Debugger Options - Embarcadero Debuggers
The first option is Debug spawned processes. Check it.

From Delphi help: Debug spawned processes
 Debugs processes that are spawned by the process you are debugging. If not checked, spawned processes are run but are not under control of the debugger.
 
I need to debug app2.exe from app1.exe.
I tried all the options load process attach process run>parameter etc nothing is working.
Working with xe3
how is the 2nd exe started ?

you debug either app with Delphi
not with the other app

unless you have built a debugger yourself ?
in that case, you don't need Delphi
if your app1 uses ShellExecute to start app2 with additional parameters

you can run that app2 straight from Delphi and pass those parameters via the menu run / parameters
if your app1 does ShellExecute(0, 'open', 'your.exe', 'param1 param2', 'yourdir' sw_shownormal)

you just fill in param1 param2 in the parameters
and start app2 in delphi
2nd exe starts by shell execute from 1st.
your 2nd exe is a standalone exe and can be started from delphi

as indicated, if you have multiple projects in a projectgroup,
you need to double click on app2 project, to activate it
and then you can debug it
I have weird issue where if I run app2 it works all good however if I launch app2 from app1 I am getting exception.
Hence trying to debug app2 from app1
and what is the exception ?
i hope you realise that you can't easily pass data from app1 to app2 ?
or vice versa
That is oracle error saying table or view does not exist I suspect somewhere session is not happy but still I should be able to debug which I am not able to at the moment
table or view does not exist is an ORA-00942
...i've got a few in front of me to solve now :)

i hope you aren't trying to let app2 use the session in app1 ?
that won't work

all resources in app1 (like connections, forms, variables) do not exists in app2
Yes that's the logic but still to confirm which connection or variable or whatever which belongs to app1 and erroneously getting accessed via app2 I need to debug app2 from app1.
you can't use anything from app1 inside app2
app2 can not access anything in memory of app1

not even global variables

the global variables of app1 belong to it's own process space
app2 has no access to this

consider that Trump has actually built his wall ...
App1 = America
App2 = Mexico

or if you back before 1989 in Berlin
App1 = west Berlin
App2 = east Berlin

if anything passes across the wall, it get's shot

you can't pass anything across the barrier, unless with special techniques
I found what I did wrong however I am wondering if it is possible to debug an exe from another or not
I searched my old projects, and found that why I can debug app2 from app1:
Beause I exported function at app2, and import it into app1, that's like DLL debugging.
unfortunately, the debug only run when the called function be called.
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial