Commit 278c409a authored by Bob Dubner's avatar Bob Dubner
Browse files

Release v0.5, with embedded cprint.py and ./cbl-gdb/'make install'

parent c90483cb
......@@ -7,13 +7,18 @@ dep = $(obj:.o=.d) # one dependency file for each source
$(project) : $(obj)
$(CPP) -o $@ $^
-include $(dep) # include all dep files in the makefile
# rule to generate a dep file by using the C preprocessor
# (see man cpp for details on the -MM and -MT options)
%.d: %.cpp
@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
c_elf.cpp : cprint_py.h
cprint_py.h : ../python/cprint.py
xxd -i ../python/cprint.py >cprint_py.h
.PHONY: clean
clean:
......
This diff is collapsed.
GDB_DATA_DIRECTORY := $(shell echo 'show data-directory'|gdb -q |tr -cd [:print:]|sed -e 's/.*\"\(.*\)\".*/\1/')
# Code to see if ~/.gdbinit already exists
AUTO_LOAD_FOUND := $(shell grep -s -e "^[ \t]*set auto-load safe-path /" ~/.gdbinit | wc -l)
AUTO_SCRIPTS_FOUND := $(shell grep -s -e "^[ \t]*set auto-load python-scripts on" ~/.gdbinit | wc -l)
.PHONY: all
all :
......@@ -10,10 +13,20 @@ pregit:
dos2unix Makefile
dos2unix .gitignore
# cprint.py needs to go into the gdb's data-directory, which can be
# seen with (gdb) show data-directory
#
# As of this writing, cprint.py is being embedded into the COBOL executables.
# By default, gdb doesn't put the current working directory onto the list
# of safe auto-load directories. There is a default safe directory, but that
# directory isn't on the search path. So, one way or the other, the user's
# .gdbinit file has to be modified. I have chosen to defeat the default
# security setting to allow auto-load from anywhere.
#
.PHONY : install
install :
echo Install not implemented
# @mkdir -p $(GDB_DATA_DIRECTORY)/auto-load/
# install cprint.py $(GDB_DATA_DIRECTORY)/auto-load/
ifeq ($(AUTO_LOAD_FOUND), 0)
echo "set auto-load safe-path /" >>~/.gdbinit
endif
ifeq ($(AUTO_SCRIPTS_FOUND), 0)
echo "set auto-load python-scripts on" >>~/.gdbinit
endif
Instructions for cprint.py, version 0.4
Instructions for cprint.py, version 0.5
The key to making cprint.py work is your personal ~/.gdbinit file.
The key to making cprint.py work is your personal ~/.gdbinit file.
Prior to version 0.4, we had a line of code in .gdbinit that always loaded
cprint.py. Mine looked like this:
However: ./python/make install now takes care of it.
# source ~/projects/cobol/batch-demo/gdb/python/cprint.py
Remove any ~/.gdbinit instructions that look like
Remove it.
source ~/projects/cobol/batch-demo/gdb/python/cprint.py
directory ~/projects/cobol/batch-demo/gdb/python
add-auto-load-safe-path ~/projects/cobol/batch-demo/gdb/python
The obmod program v0.4 is putting a directive into the ELF executable file that
directs gdb to load cprint.py when, and only when, a COBOL executable is loaded.
We have to set up .gdbinit so that gdb knows where to find cprint.py and has
permission to load it.
You can leave this next one; if you take it out, the install will put it back in
Put the following instructions (don't forget to modify them as necessary for
the location of your copy of cprint.py) into your ~/.gdbinit file:
set auto-load python-scripts on
################################
set auto-load python-scripts on
directory ~/projects/cobol/batch-demo/gdb/python
add-auto-load-safe-path ~/projects/cobol/batch-demo/gdb/python
################################
You can see the dynamic loading of cprint.py working like this:
Just start gdb and execute:
(gdb) info auto-load python-scripts
No auto-load scripts.
Now load a COBOL executable:
(gdb) file rtest
Reading symbols from rtest...done.
registering CPrint v0.4 , (Usage is "print <COBOL identifier>")
Note that cprint.py announces that it was registered itself:
This can be verified thusly:
(gdb) info auto-load python-scripts
Loaded Script
Yes cprint.py
full name: /home/bob/projects/cobol/batch-demo/gdb/python/cprint.py
And you can verify that it is appropriately unloaded:
(gdb) file
No executable file now.
Discard symbol table from `/home/bob/projects/cobol/batch-demo/gdb/samples/ref_test_2/rtest'? (y or n) y
No symbol file now.
(gdb) info auto-load python-scripts
No auto-load scripts.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment