How do I redirect Tornado / VXWorks shell output?

2019-01-28 11:46发布

I've been working on an embedded C/C++ project recently using the shell in Tornado 2 as a way of debugging what's going on in our kit. The only problem with this approach is that it's a complicated system and as a result, has a fair bit of output. Tornado 'helpfully' scrolls the window every time some new information arrives which means that if you spot an error, it disappears out of site too quickly to see. Each time you scroll up to look, the system adds more information, so the only way to view it is to disconnect the hardware.

I'd love to know if anyone has a way of redirecting the output from Tornado?

I was hoping there might be a way to log it all from a small python app so that I can apply filters to the incoming information. I've tried connecting into the Tornado process, but the window with the information isn't a standard CEditCtrl so extracting the text that way was a dead end.

Any ideas anyone?

[Edit] I should have mentioned that we're only running Tornado 2.1.0 and upgrading to a more recent version is beyond my control.

[Edit2] The window in question in Tornado is an 'AfxFrameOrView42' according to WinID.

4条回答
再贱就再见
2楼-- · 2019-01-28 12:25

here is another potential way:

-> saveFd = open("myfile.txt",0x102, 0777 )
-> oldFd = ioGlobalStdGet(1)
-> ioGlobalStdSet(1, saveFd)
-> runmytest()
...
-> ioGlobalStdSet(1, oldFd)

this will redirect all stdout activity to the file you opened. You might have to play around with the file name of the open to make it write on the host (e.g. use "host:/myfile.txt" or something like this)

查看更多
聊天终结者
3楼-- · 2019-01-28 12:28

I am making the assumption that you are using the host shell to perform this.

If you are running a test by launching it from the shell like "runTest()", you can use the redirection operator (>) to send the output of that function to a text file on your host machine.

 > runTest() > mytestResults.txt

This will save any output that runTest generates to the file mytestResults.txt

If you would like to capture everything on the screen all the time, I will have to dig more into this.

查看更多
做个烂人
4楼-- · 2019-01-28 12:32

The host shell has a recording capability built in. There are 3 environment variables available (in 6.x - not available in 5.x):

RECORD (on/off) : Controls recording of the shell
RECORD_TYPE (input/output/all): Determines what you will be recording
RECORD_FILE : Filename to save things to.

you use the ?shConfig command to configure the shell environment variable. ?shConfig by itself displays the variables. Here is how I set mine up:


-> ?shConfig
...
RECORD = off
RECORD_FILE = C:/test.txt
RECORD_TYPE = output
...

-> ?shConfig RECORD_TYPE all
-> ?shConfig RECORD_FILE myData.txt
-> ?shConfig RECORD on
Started recording commands in 'myData.txt'.
查看更多
狗以群分
5楼-- · 2019-01-28 12:47

rlogin vxWorks-target | tee redirected-output.txt

查看更多
登录 后发表回答