How to properly configure dap-mode to debug c/c++? - emacs

I am new to emacs. Recently, I saw on the forum that the C language can be debugged using dap-mode, but when I configure dap-mode according to the official tutorial, there are always various errors at runtime. Would like to ask if anyone has successfully configured dap-mode so that the C language can be debugged. If so, can you post the full configuration for me to study,thanks

Related

Eclipse Xtext and an independent LSP server do not (appear to) work together - should they?

I have an independently written LSP-compliant language server for a custom language and an Xtext framework for that language, as Eclipse plugins. The two work fine independently; the LSP is connected in using LSP4E.
But when I try to connect the Language Server into a project in which Xtext is providing syntax coloring and some parsing checking, it appears that the language server is never started and certainly is not providing the error messages to the Eclipse UI that it does when used by itself. I'm not asking Xtext to create a language server itself.
The goal is to use (and not reimplement) the LS for parsing and type checking and language-aware code navigation, while using Xtext for syntax coloring.
Can anyone point me to a successful use of these two technologies together? or know that they cannot (yet?) be?
Edit: To the comment about checking whether the LS is working. As far as I can tell, the LS is not even started, though it started fine when used alone. Somehow putting Xtexxt into the mix has usurped the connection to the LS or changed it in a way that the launching and use no longer happens.
The LSP4J version installed is (only) Eclipse LSP4J org.eclipse.lsp4j 0.15.0.v20220805-0131 org.eclipse.lsp4j
Xtext's components vary, but basically Eclipse Xtext Xtext 2.28.0.v20220829-0438 org.eclipse.xtext

How do I get a server up and running in WebStorm?

Because of cross domain issues I need to run my code (which is HTML & JS) via a server in WebStorm. None of the instructions I can find are simple and straight forward. Can someone give me an idiots' guide to doing this?
Alternatively, I have got Tomcat up and running in Eclipse, but I can't figure out how to import a non-java project into it. Again, instructions that a bear of little brain can follow would be appreciated.
WebStorm comes with a built-in static web server, listening on localhost:63342. All you need to do to run your code on it is right-clicking your .html file and choosing Run.
see also https://www.jetbrains.com/help/webstorm/2017.3/debugging-javascript-in-chrome.html, Debugging an application running on the built-in server

postgres attaching a process

How do we attach a sql query such as join query to an existing gdb process in eclipse? Whenever I try to fork the given process using debug configurations in eclipse, which is a shared library , I am getting the following error:
No source available for "__kernel_vsyscall() at 0xb729c424"
Also, whenever I set break points in a specific program in eclipse, control goes to main.c and finally the process never comes back to the actual program.
Is there any way that the process be constrained only to my specific program?
how do we attach a sql query such as join query to an existing gdb process in eclipse
Um, what?
Are you attempting to debug a PostgreSQL server backend? If so, see the PostgreSQL wiki page that provides lots of details on the topic.
Whenever I try to fork the given process using debug configurations in eclipse, which is a shared library
What is a shared library? Eclipse isn't. PostgreSQL isn't. So what's the shared library here?
Are you trying to debug a PostgreSQL extension? If so, see the above link for details on attaching to a PostgreSQL server backend.
No source available for "__kernel_vsyscall() at 0xb729c424"
That's normal. It's just telling you that there's no source code on record for the __kernel_vsyscall call that's the entrypoint into syscalls in linux-gate.so via glibc when using sysenter.
The stack below it should be more informative. Get a backtrace, then look at the lower stack frames.
See:
What is __kernel_vsyscall?
Having trouble finding the method __kernel_vsyscall within the Linux kernel
http://www.trilithium.com/johan/2005/08/linux-gate/
Your "also" is really a separate question, and it's pretty hard to answer it usefully with the total lack of information provided. Try posting a new, more detailed question on just that topic. Specify how you compiled the program, set it up for debugging, how you're running it, where you're trying to set breakpoints, etc.

What language does SmartFoxServer 2x use on the server side?

I have downloaded and started the community version of SFSx2. I read everything on their documentation page:
http://docs2x.smartfoxserver.com/DevelopmentBasics/introduction
Which unfortunately only talks about flash client side code. Nothing about the corresponding server side code, nor about html5 client side which I need.
I downloaded the HTML5 examples, which took me a long time to find (they are here: http://www.smartfoxserver.com/download/get/140 )
None of the examples work, as they can't connect to the server. Presumably, this is because the examples only supply client side code. There are no instructions supplied on how to install or run the examples.
I can find no mention on the smartfox documenation on the following:
1) what language is used on the server side. One assumes its java.
2) how does one deploy java code to the smartfox server? I cant find any mention of this in the docs.
3) how does one find and install the server part of the client side examples (which are Tris, GameLobby, BuddyMessenger, AdvancedChat).
I applied to be allowed to post on the smartfoxserver forums, but no reply yet.
I also found it hard so I share what I've found out.
The server extensions are written in Java. I used Eclipse JUNO to write my code.
You can download Eclipse here. http://www.eclipse.org/downloads/
You export the extension in jar format from eclipse into you extension path. The name of your file has to end in 'extension' eg MyFirstExtension.jar otherwise sfs2x wont recognize it. Your extension path will be something like this: C:\Program Files\SmartFoxServer2X\SFS2X\extensions\MyFirstExtension\MyFirstExtension.jar if your working in windows.
You will find docs on JAVA API here. http://docs2x.smartfoxserver.com/api-docs/javadoc/server/
This is a link to the basic example code: http://www.smartfoxserver.com/download/get/120
Unzip the content into the [SFS2X_install_folder]/SFS2X/www/root/examples folder, overwriting the existing file. Run the index.html file, then navigate to another index.html to open the example. Run the sfs2x-standalone.exe first of course(see below). If you followed the 'server configuration tutorial' on smartfox website and changed the server ports, the examples wont work. Leave the ports alone until you start to understand the server.
This is a link to the flash example code: http://www.smartfoxserver.com/download/get/108
You will find the example code for apps mentioned above. They are written in Adobe Flash Builder and Java extensions. I don't know if there is any code for HTML5 but the Java server code and AS3 is there.
I also found that using the standalone server was the way to go rather than using SFS2x as a service. c:\program files\smartfoxserver2x\sfs2x\sfs2x-standalone.exe. Using the exe gives you the command prompt window. You can use the window for debugging and see the state of the server when it starts.
Most of the examples should work without creating extensions but to create an extension out of source examples:
Create and setup a new project in your Java IDE. You will have already set up a workspace.
Copy the content of the /source/server/src folder to your project's source folder.
Add SFS2X Libraries. Go to properties of the project -> Select Java Build Path -> Click Library Tab -> Add external jar. Add 'sfs2x.jar' and 'sfs2x-core.jar' from C:\Program Files\SmartFoxServer2X\SFS2X\lib folder. To create the extension, export jar file to extension path. Restart server.
Another problem I had was the Java Version I was using. I had to use Java1.6 with my version of sfs2x when writing extensions. This was trial and error as there was no documentation. There may be a newer version out now.
I had to copy all the server source into eclipse to try and understand how things were done. It was a way of having all the code in one place. There was a lot of trial and error as getting help is hard. I eventually accomplished what I set out to achieve. Good Luck.
SmartFox Server is easy to use even with extension. documentation Give try to Nuggeta solution for game development too. No extension needed at first. This is optionnal.
We have full HTML5 open source game walkthrough on github

Symfony, netbeans 6.8 and debugging a web page

I am using Symfony (1.31) - with Propel ORM to build a website. I have recently moved from using a text editor, to Netbeans (6.8) as my dev environment.
Coming from a compiled language (C++) background, I am used to setting break points in code etc as part of debugging. Web development I have encountered (atleast with PHP), has been largely hit and miss - well debugging has been messy to say the least, using echo statements, logging stuff to file etc. Well I hear that it is possible to debug PHP (i.e. set breakpoints etc).
I have scoured the net for documentation to show how to set breakpoints (say in one of the MVC layesrs) so that when the relevant page(s) is opened via a browser, the breakpoint will get hit and I can step through the code (ideally, watching the program variables).
Is this possible using Symfony and Netbeans 6.8?.
There seems to be support for XDebug: http://netbeans.org/kb/docs/php/debugging.html
If you have specific questions about configuring XDebug: http://wiki.netbeans.org/HowToConfigureXDebug.
More useful articles on PHP development in NetBeans: http://netbeans.org/kb/trails/php.html.
Hope that helps.
UPDATE: Just installed NetBeans 6.8 and ran through the configuration and was able to get breakpoints to work successfully with XDebug. NetBeans' integration with Symfony is pretty slick too, +1 to question for getting me to check this out.
Here is what has helped me debug my Symfony apps:
Enable logging and the web debug toolbar via apps/appname/config/settings.yml. Note: Any changes will require clearing the cache.
dev:
.settings:
web_debug: true
logging_enabled: true
Use var_dump() or print_r() with pre tags to dump data from anywhere. Adding exit; will allow you to dump variables from the controller or anywhere else.
echo '<pre>';
vardump($something);
echo '</pre>';
exit;
Enable logging and log messages. You can access the logger anywhere as well, but make sure you enable logging for your environment:
sfContext::getInstance()->getLogger()->info($message);
I've used Gubed with Quanta+ as a stepping debugger with PHP, don't know if you can get that to work with Netbeans but I thought it was more hassle that it was worth. I found that I could for(i=0;i<~6;i++){dump stuff to screen/log; make changes; reload;} and solve an issue in less time than it took me to step through it once with the debugger.
Xdebug is a very useful PHP extension which features a remote debugger with support for some editors, though Neatbeans isn't listed. I've not used the remote debugging element of Xdebug (see above) but the profiling, code coverage and - in particular - improved browser error messages I find helpful.
Generally with Symfony I find I can get most of what I need from stack traces or by dropping items into the logger and picking them up with either the debug toolbar or firesymfony.
Netbeans 7+ has trouble with xdebug breakpoints in the model/action. You have to use the manual function to set breakpoints.
xdebug_break();