Gdbserver for Snow Leopard? - c

So I have this source gdb-1515. I'm using Xcode 3.2.6 command line tools on Snow Leopard (and this gdb source is the source of the gdb included in them).
Trying to run (inside /private/var/root/Downloads/gdb-1515/src/gdb/gdbserver):
gcc -I. -I. -I./../regformats -I./../macosx -I./../../include -I../../bfd -I./../../bfd -I/private/var/root/Downloads/gdb-1515/src/bfd ./../macosx/macosx-nat.c
Fails with:
./../macosx/macosx-nat.c:34:17: error: bfd.h: No such file or directory
./../macosx/macosx-nat.c:35:18: error: defs.h: No such file or directory
./../macosx/macosx-nat.c:36:21: error: gdbcore.h: No such file or directory
./../macosx/macosx-nat.c:37:20: error: serial.h: No such file or directory
./../macosx/macosx-nat.c:38:22: error: ser-base.h: No such file or directory
./../macosx/macosx-nat.c:39:22: error: ser-unix.h: No such file or directory
./../macosx/macosx-nat.c:40:22: error: inferior.h: No such file or directory
./../macosx/macosx-nat.c:41:23: error: objc-lang.h: No such file or directory
./../macosx/macosx-nat.c:42:21: error: infcall.h: No such file or directory
In file included from ./../macosx/macosx-nat-dyld.h:5,
Etc.
Thing is there is no bfd.h anywhere inside the gdb-1515 folder.
find /private/var/root/Downloads/gdb-1515 -name bfd.h
Returns no output.
I want to call attach_to_classic_process (defined inside macosx/macosx-nat.c) from gdbserver/macosx_low.c:476 instead of ptrace - that's why I'm trying to build macosx/macosx-nat.c from the gdbserver directory.
Currently at its place it's used ptrace which fails for rosetta processes.
Ok so I want to debug a classic (Rosetta) process running on Snow Leopard by using remote gdb connection.
It should be obvious cause after all Rosetta applications are using remote connection for debugging anyway.
Additionally gdb application can successfully connect with mentioned PowerPC applications.
I'm trying to compile gdbserver from this apple source however this is Aids - it seems that the way gdbserver included in this packages is fundamentally wrong since the original gdb is using special functions to establish connection to classic process while gdbserver is trying to use ptrace which obviously fails.
Another thing that comes into my mind is why the hell gdbserver has to be so retardedly complicated - why isn't directly co-operating with the functional gdb command line application (maybe a wrapper of sorts)?

Related

installing/accessing openGL on MacOSX Monterey

I am trying to compile an X11-based program to visualize atomic structures called v_sim on MacOSX Monterey (12.6) on a M1 Apple system. I am compiling the program using a command line environment and there is an option in the configure program to specify Apple's openGL framework "--with-apple-opengl-framework". The configure program stops, however, with the error
configure: error: "No 'GL/glx.h' header file."
How can I specify the location of this header file? There doesn't seem to be an option in the configure command to do so. There also does not seem to be header files in the Framework subdirectories. Any suggestions as to what to try next?

qnx run error : Attempting to exec a shared lib

I managed to setup the Neutrino 6.5.0 RTOS in a virtual box and connect to it over qconn from Momentics IDE for Blackberry IDE 2.1.2 .....
I can get the system information perspective view for my Neutrino.
BUT
when I am trying to run my compiled application I am getting the errors :
Could not launch
Cannot find qnx launch process
and
Error starting remote application.
Target launcher#<192.168.56.101:8000>: Error: Attempting to exec a shared lib
SO I manually copied the executable file I compiled to the /tmp dir on my Neutrino virtual machine and run it using ./Test ,still get this error:
"/bin/sh: ./Test: Attempting to exec a shared lib"
I rechecked the project option and make sure that this is an Application output and not a shared library output type.
Any idea what am I doing wrong ?
I also encountered the same problem. Later, I found that the cross compiler was selected incorrectly. This error occurs when x86 programs are run on arm processors; Specify the correct compiler to solve the problem;

Checking the reason for segmentation fault on Linux server

I have a Linux script written in C Language deployed at a remote server, to which multiple clients can connect. Due to some reason the script crashed and when I am trying to restart it I am getting segmentation fault.Is there any way by which I can Check at server side that what is stopping my script from starting, and is throwing segmentation fault error.
Start out by enabling core dumps:
$ ulimit -c unlimited
Now run the script until it segfaults. This will create a core dump file in your working directory.
Next, use GDB (or any frontend of it) to debug it (note that you can copy the file to your local machine if you can't debug on the server):
$ gdb -c <core_file>
Don't forget to add the symbol file:
GDB> file my-prog
If it's easy to reproduce the problem, and provided you can debug directly on the server (with SSH or such), you can simply dive in and start the process with a debugger attached:
$ gdb my-prog

Clang error when trying to open a C file

I recently downloaded vim and I made a simple Hello World program in C. I installed clang after I saw that Gcc had errors on cmd. They both did. I also installed cygwin and tried cmd with both compilers and still nothing.
I keep on getting these errors
1 [main] clang 304 child_info_fork::abort: C:\cygwin\bin\cygLLVM-3.5.dll:
Loaded to different address: parent(0x1A10000) != child(0x1710000) clang:
error: unable to execute command: posix_spawn failed: Resource temporarily
unavailable
I think I have more hope for clang than for gcc
Short Answer: If your Cygwin installation is directly under your C: drive, shutdown Cygwin and try this command in the Windows command prompt:
C:\cygwin\bin\dash.exe -c '/usr/bin/rebaseall -v'
This is a Cygwin fork failure.
As noted in link above, one solution is to do a 'rebase':
Read the 'rebase' package README in /usr/share/doc/rebase/, and follow the instructions there to run 'rebaseall'.
According to the README:
Use the following procedure to rebase your entire system:
1. shutdown all Cygwin processes and services
2. start ash or dash (do not use bash or a terminal emulator like rxvt
or mintty). The easiest way to do this is to use Windows Explorer
and navigate to the top level of your cygwin installation, and
double-click ash.exe or dash.exe in the bin/ directory.
3. execute /bin/rebaseall (in the ash/dash window)
If you get any errors due to DLLs being in-use or read-only, then take the
appropriate action and rerun rebaseall. Otherwise, you run the risk of fork()
failing.

fatal error: sys/socket.h: No such file or directory on 32bit

When compiling my program in 32bit using
gcc -m32 program.c -o program
I get the following error fatal error: sys/socket.h: No such file or directory
but with
gcc program.c -o program
it works fine
Is there any workaround for this?
my personal similar problem was solved as below:
by the way I am using cygwin.
The reason behind this error is trying to compile a unix c socket example in a window environment.
If you want to use windows, I think you should have cygwin installed with all the libraries needed for compiling c programs ;"gcc is the one used for generated Your_program_in_exe ".
Then start with compiling the server the server.follow this tutorial to understand about the basic of sockets.
You should have a client and a server programs.then go(using cd command) to the directory where you stored your code and perform the commands:
1- gcc socket-Server.c -o server to generate the execution file for the server.
this will generate server.exe file which will allow you to use ./server.exe to run the sever on your PC.if there is no error in your file you should have the .exe file in the your directory.
2- gcc socket-client.c -o client to generate the execution file for the client. This will generate the file client.exe file which allows you to execute the client.if there is no error u should have the client.exe together with ur server.exe in the file directory.
the screen capture below shows the commands i used and the basic output

Resources