FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: daubsi am 26 Oktober 2016, 21:11:03

Titel: fhem in Eclipse debuggen
Beitrag von: daubsi am 26 Oktober 2016, 21:11:03
Hallo,

nachdem ich mein MBus Modul die letzten Wochen mehr oder weniger unkomfortabel mit vi und der Shell entwickelt habe, wollte ich nun versuchen das ganze mit dem Perl Modul in Eclipse weiterzuführen um die Annehmlichkeiten von Syntaxhighlighting und Debugger zu haben. Ich habe das ganze FHEM Verzeichnis in Eclipse in ein Perl Projekt eingebunden, meinen @INC richtig (?) gesetzt und wollten nun "fhem.pl fhem.cfg" im Debugger starten.

Dieser spuckt mir nur jede Menge Fehler(?) bzgl. Redefines aus und beendet sich dann.

main::AnalyzeCommand(undef, 'define telnetPort telnet 7072 global', undef) called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 866
main::AnalyzeCommandChain(undef, 'define telnetPort telnet 7072 global') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1122
main::CommandInclude(undef, 'fhem.cfg') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 458
Constant subroutine main::ENODEV redefined at FHEM/TcpServerUtils.pm line 8, <$fh> line 16.
main::BEGIN() called at FHEM/TcpServerUtils.pm line 8
eval {...} called at FHEM/TcpServerUtils.pm line 8
require TcpServerUtils.pm called at ./FHEM/98_telnet.pm line 10
main::BEGIN() called at FHEM/TcpServerUtils.pm line 8
eval {...} called at FHEM/TcpServerUtils.pm line 8
require ./FHEM/98_telnet.pm called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 2022
eval {...} called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 2021
main::CommandReload(undef, '98_telnet') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1531
main::LoadModule('telnet') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1573
main::CommandDefine(undef, 'telnetPort telnet 7072 global', 'define') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 987
main::AnalyzeCommand(undef, 'define telnetPort telnet 7072 global', undef) called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 866
main::AnalyzeCommandChain(undef, 'define telnetPort telnet 7072 global') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1122
main::CommandInclude(undef, 'fhem.cfg') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 458
Constant subroutine main::EPERM redefined at FHEM/TcpServerUtils.pm line 8, <$fh> line 16.
main::BEGIN() called at FHEM/TcpServerUtils.pm line 8
eval {...} called at FHEM/TcpServerUtils.pm line 8
require TcpServerUtils.pm called at ./FHEM/98_telnet.pm line 10
main::BEGIN() called at FHEM/TcpServerUtils.pm line 8
eval {...} called at FHEM/TcpServerUtils.pm line 8
require ./FHEM/98_telnet.pm called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 2022
eval {...} called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 2021
main::CommandReload(undef, '98_telnet') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1531
main::LoadModule('telnet') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1573
main::CommandDefine(undef, 'telnetPort telnet 7072 global', 'define') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 987
main::AnalyzeCommand(undef, 'define telnetPort telnet 7072 global', undef) called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 866
main::AnalyzeCommandChain(undef, 'define telnetPort telnet 7072 global') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 1122
main::CommandInclude(undef, 'fhem.cfg') called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 458
Constant subroutine main::EBUSY redefined at FHEM/TcpServerUtils.pm line 8, <$fh> line 16.
main::BEGIN() called at FHEM/TcpServerUtils.pm line 8
eval {...} called at FHEM/TcpServerUtils.pm line 8
require TcpServerUtils.pm called at ./FHEM/98_telnet.pm line 10
main::BEGIN() called at FHEM/TcpServerUtils.pm line 8
eval {...} called at FHEM/TcpServerUtils.pm line 8
require ./FHEM/98_telnet.pm called at /Users/daubsi/Documents/workspace/My FHEM/fhem_opt/fhem.pl line 2022


Ob das jetzt fatal Fehler sind kann ich nicht mal sagen, ich vermute nicht.

Der Debug bricht m.E. um die Zeile 410 in fhem.pl ab.
Da scheint fhem zu forken.

# As newer Linux versions reset serial parameters after fork, we parse the
# config file after the fork. But we need some global attr parameters before, so we
# read them here.
setGlobalAttrBeforeFork($attr{global}{configfile});

Log 1, $_ for eval{@{$winService->{ServiceLog}};};

# Go to background if the logfile is a real file (not stdout)
if($^O =~ m/Win/ && !$attr{global}{nofork}) {
  $attr{global}{nofork}=1;
}
if($attr{global}{logfile} ne "-" && !$attr{global}{nofork}) {
  defined(my $pid = fork) || die "Can't fork: $!";
  exit(0) if $pid; <-- hier beendet sich die Debug session
}

# FritzBox special: Wait until the time is set via NTP,
# but not more than 2 hours
if(time() < 2*3600) {
  Log 1, "date/time not set, waiting up to 2 hours to be set.";
  while(time() < 2*3600) {
    sleep(5);


Das warum ist mir klar - der Parentprozess wird offenbar beendet. Die Frage ist: Wie kann ich dennoch in Eclipse FHEM bzw. die Module debuggen?
Mein Ziel ist es fhem im Debuger zu starten und dann in meinem Modul Breakpoints, Variable inspection, Single step etc. zu nutzen.

Hat jemand eine Idee, wie ich meine IDE dafür konfigurieren muss?

Besten Dank!