Modifying the Eclipse Debugger - eclipse

I am attempting to modify the eclipse CDT debugger to allow my to step though my code on my FR family Fujitsu board. The board can only be communicated by the SOFTUNE IDE. Fujitsu provides a dll for communicating with with SOFTUNE's debugger.
Making a simple c++ program I was able to get this to work and control the SOFTUNE.
The supplied commands in the .dll are:
Initialize();
Openproject();
Build();
Go();
Stop();
TargetFile();
Reset();
ReadPC();
SetBreak();
GetDebuggerStatus();
GlobalSymbolToAdrress();
ExpressionToAdrress();
WriteMemory();
ReadMemory();
The issue I am having is making a plugin to the CDT debugger to pass commands using the dll. Searching the web i can only find making my own debugger, is there an easier way then starting from scratch?

Related

Creating module with pybind11 and debugging it in python at runtime crash

I'm re-posting my issue from https://github.com/pybind/pybind11/discussions/4477 to here as I'm not getting much luck there for now...
To summarize I have c++ application that has python in it via boost. I want to load a c++ dll in to it via pybind11 and debug my dlls at runtime via attaching myself to the process and breakpoints in the source.
Sadly when I hit breakpoint I get that crazy error that you can see there.
I think this is the relevant part >
00007FFAE47AEAA5 (ucrtbased): (filename not available): get_wide_winmain_command_line
00007FFAE47AE8C3 (ucrtbased): (filename not available): get_wide_winmain_command_line
00007FFAE47B158F (ucrtbased): (filename not available): wassert
00007FFACC14B3F0 (python37_d): (filename not available): PyAST_Validate
S:\vcpkg\installed\x64-windows\include\pybind11\detail\internals.h (414): `pybind11::detail::get_internals'::`2'::gil_scoped_acquire_local::gil_scoped_acquire_local
S:\vcpkg\installed\x64-windows\include\pybind11\detail\internals.h (417): pybind11::detail::get_internals
S:\RnD\DLL_python\c_DLL_Python_01\icLib\library.cpp (34): PyInit_mydll
I've tried setting up compiler flags/etc but sadly no luck.
Has any1 been able to compile pybind11 to pyd dll on windows & load it in python and then breakpoint into it?
To any1 wondering why I'm jumping over soo many hoops and not using python... I wrote a framework in c++ that works between 4 apps via c++ api, sadly 5th app is only python and thus I "can" use my framework via pybind11 but I need help debugging.

Variable evaluation fails in Eclipse when debugging JavaScript using Chrome Dev Tools

I have installed the Chrome Dev Tools Eclipse plug-in as described on http://code.google.com/p/chromedevtools/ and debugging JavaScript basically works. I can set breakpoints in my JavaScript source files and when I run the JavaScript code in Chrome, Eclipse stops the execution and opens the Debug perspective. Stepping through the code works fine, and I can also see the local and global variables in the Variables view.
When clicking on one of the variables, the detail view shows an error message, though:
Helper script failed on remote: _com_chromium_debug_helper is not defined
Did I miss something during the installation?
Update
Added an issue on the project's page: http://code.google.com/p/chromedevtools/issues/detail?id=85
Most likely you should open an issue at the project page. It is definitely a bug and fixing it might require additional context from you.
This is internals of ChromeDevTools SDK's workaround for WebKit Remote Debugging protocol limitations.

Debugging embedded system with Eclipse - HOW TO PRINT TO A LOGGING FILE?

I'm currently working on a project on STM32F4 and I'm using Eclipse. I've got some problems with the program - it seems to have a random behavior - sometimes it works fine, other times it has some errors. Sometimes when I try do debug with breakpoints I get the beautiful HardFault Handler and it really messes with my brains.
Sorry for the little off-topic paragraph, just wanted to let you know why I decided to use printing to a log file at some key moments in the program so I can see in which states and in which functions does the problem occur. I'm debugging through a JTAG interface with Eclipse (gdb) and I need to know if there is an easy method integrated in Eclipse that may help me use fprintf-like functions inside my program to write to a file on the disk.
If no, any other solutions?
Thanks
I do not like to connect the debug output log to the Jtag communication port because the log will not be available after development.
I usually build an SystemLog library that can send the log messages through any medium that is available (UART, USB, Ethernet or SDCARD). That's what I'd recommend you to do. It will help you through the development, and the support team on the event of any failure on field.
If stdlib is available in your project you should use the snprintf family functions to build your SystemLog.
Also, you can integrate the log output to the eclipse console by calling a serial console communicator (if you use UART) on you makefile, in this case, your makefile will have to flash the target as well.

Debugging STMF4 Discovery in Eclipse using GDB

Hello all: I have never posted on Stackoverflow, but I have always come here for help for years.
I have a question and problem regarding debugging in eclipse using an STLINK STM32 Discovery board. I have looked online for the answer and have followed many tutorials, but I still cannot seem to get it to work correctly. I will try my luck at asking here.
I have set up the eclipse environment correctly with my compiler and gdb server (to my knowledge). First I make sure the server is started before I press debug in eclipse. I am using Atollic STLINK gdb server. I have tried many arm-none-eabi-gdb type exe's while debugging, but they all seem the same. My debug configuration is setup to use arm-none-eabi-gdb on port 61234 (Attolic). When I press debug, the program launches correctly and goes into the debug view in eclipse. The program downloads correctly to my discovery board. I know this because I have gotten debugging to work partially and have stepped through the code without crashing on 'some' occasions depending on the compiled code and debug configuration startup options. The code is a simple LED turn on on the board. If I unplug the usb cable and plug it back in, my code runs fine, because the LEDs light up, so we know the environment is probably set up correctly, because the code downloads to flash via eclipse commands.
The problem is with actual debug steps. 99% of the time the arm-none-eabi-gdb.exe program crashes when in the debug view after I do a few "step into's" with the debugger commands at the top of eclipse. After the first line of my main function is reached, I will try to step into the first line and I get a windows crash of the arm-eabi.exe program. The debug console in eclipse reads a gdb error: .......dwarf2: C10xx Internal Error - unknown CFA rule. Now... depending on how I set the options in the debug configuration with regards to the startup tab, different options produce different results and the following options have been toggled: Halt, resume, break point at : main, etc.. This crash also seems to be dependent on the code being compiled in the main function.
Now, does this have any dependency on which compiler is used with the gdb server and arm-none-eabi-gdb.exe programs? For instance, if I compiled the code with Atollic versus Keil versus code sourcery versus IAR, would the Attollic gdb service + arm-none-eabi-gdb programs be able to work with any compiled code? Are there some missing symbols somewhere not being generated? For reference, I am using an EVAL version of the IAR compiler tool set. If I make a project with the same code in embedded workbench using the STLINK, the code compiles and debugs fine.
What is a CFA rule? Call frame address? Am I not setting up the stack pointer or something in my program? I thought the IAR compiler took care of all that junk in the cstartup.
Any help is appreciated.
Thanks,
LostTime77

How can I redirect JNI console output to Eclipse Console view, when Eclipse plugin uses JNI?

I have an Eclipse plugin (A) which has a dependency on another plugin (B). Plugin B is simply a wrapper around a jar, which contains a native dll, and performs jni functionality.
Given this setup, I have the following code in A's Activator class's start method:
MessageConsole jniConsole = new MessageConsole("Opereffa Output", null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { jniConsole });
ConsolePlugin.getDefault().getConsoleManager().showConsoleView(jniConsole);
MessageConsoleStream stream = jniConsole.newMessageStream();
System.setOut(new PrintStream(stream));
System.setErr(new PrintStream(stream));
When plugin A performs its functionality, any use of System.out actually goes to the console within Eclipse. But native code used by JNI also writes to output stream, which I can't grab.
During development, output from JNI goes to the console of the Eclipse instance which has launched the running instance, which contains the plugins.
So how do I grab the JNI output and display in the console?
You could try using freopen to redirect stdout in exactly the same way as you do in Java, but on the native side. The question is whether this would work if you used it in your own plugin (with a new JNI dll): it may need to be used from within the dll doing the console output, I've no idea of the interaction between streams across DLLs. If stdout refers to a shared stream for the whole process, maybe it would work.
You can't, really. The native DLL uses stdio methods that you can't access from Java. If you write to System.out, the Java runtime eventually uses the same methods but for obvious reasons, changes the System.out have no effect to underlying the C runtime.
There is a hardware solution: Get a second monitor so you can see the terminal in which you started Eclipse all the time.
E.g. Eclipse 2019-06 regularly delegates std::printf(...) and std::cout from JNI code to the Console View
Flushing (=actually printed) is done by fflush(stdout);.