I want to change the default location of core dump files so that every time a core dump is generated ,it goes to that directory.Also, is it possible to save the dump file by the name of the crashed file in this location?
Yes, it is. You can change /proc/sys/kernel/core_pattern
to define the pathname used to generate the corefile. For more, see man core
example:
echo '/tmp/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern # `tee' instead of > so that
# opening happens in the
# elevated process
would cause all future core dumps to be generated in /tmp
and be named core_[program].[pid]